diff --git a/CalamityMod.cs b/CalamityMod.cs index 093a7c2084..9e05a06d3c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -5,8 +5,6 @@ using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using CalamityMod.Balancing; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; @@ -14,6 +12,7 @@ using CalamityMod.DataStructures; using CalamityMod.Effects; using CalamityMod.Events; using CalamityMod.FluidSimulation; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Items.VanillaArmorChanges; @@ -34,7 +33,6 @@ using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; @@ -215,6 +213,7 @@ namespace CalamityMod { LoadClient(); GeneralParticleHandler.Load(); + PrimitiveRenderer.Initialize(); ForegroundDrawing.ForegroundManager.Load(); // Wikithis support diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs new file mode 100644 index 0000000000..255b408326 --- /dev/null +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Graphics.Primitives +{ + /// + /// This manages rendering primitives in via the provided method.

+ /// To use normally, in the draw method of an NPC or Projectile call .
+ /// + /// The first param should be the positions to use for the trail. + /// The second is a struct that allows you to choose a desired configuration of settings to use with the trail, to allow for customization. + /// The third controls how many points are created for the trail, and the fourth determines whether the primitive is subsequently rendered. + /// + /// 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 + { + #region Static Members + private static DynamicVertexBuffer VertexBuffer; + + private static DynamicIndexBuffer IndexBuffer; + + private static PrimitiveSettings MainSettings; + + private static Vector2[] MainPositions; + + private static VertexPosition2DColorTexture[] MainVertices; + + private static short[] MainIndices; + + private const short MaxPositions = 1000; + + private const short MaxVertices = 3072; + + private const short MaxIndices = 8192; + + private static short PositionsIndex; + + private static short VerticesIndex; + + private static short IndicesIndex; + + internal static void Initialize() + { + Main.QueueMainThreadAction(() => + { + MainPositions = new Vector2[MaxPositions]; + MainVertices = new VertexPosition2DColorTexture[MaxVertices]; + MainIndices = new short[MaxIndices]; + VertexBuffer ??= new DynamicVertexBuffer(Main.instance.GraphicsDevice, VertexPosition2DColorTexture.VertexDeclaration2D, MaxVertices, BufferUsage.WriteOnly); + IndexBuffer ??= new DynamicIndexBuffer(Main.instance.GraphicsDevice, IndexElementSize.SixteenBits, MaxIndices, BufferUsage.WriteOnly); + }); + } + + private static void PerformPixelationSafetyChecks(PrimitiveSettings settings) + { + // Don't allow accidental screw ups with these. + if (settings.Pixelate && !PrimitivePixelationSystem.CurrentlyRendering) + throw new Exception("Error: Primitives using pixelation MUST be prepared/rendered from the IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives method, did you forget to use the interface?"); + else if (!settings.Pixelate && PrimitivePixelationSystem.CurrentlyRendering) + throw new Exception("Error: Primitives not using pixelation MUST NOT be prepared/rendered from the IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives method."); + } + + /// + /// Renders a primitive trail. + /// + /// The list of positions to use. Keep in mind that these are expected to be in world position, and is automatically subtracted from them all.
At least 4 points are required to use smoothing. + /// The primitive draw settings to use. + /// The amount of points to use. More is higher detailed, but less performant. By default, is the number of positions provided. Going above 100 is NOT recommended. + public static void RenderTrail(List positions, PrimitiveSettings settings, int? pointsToCreate = null) => RenderTrail(positions.ToArray(), settings, pointsToCreate); + + /// + /// Renders a primitive trail. + /// + /// The list of positions to use. Keep in mind that these are expected to be in world position, and is automatically subtracted from them all.
At least 4 points are required to use smoothing. + /// The primitive draw settings to use. + /// The amount of points to use. More is higher detailed, but less performant. By default, is the number of positions provided. Going above 100 is NOT recommended. + public static void RenderTrail(Vector2[] positions, PrimitiveSettings settings, int? pointsToCreate = null) + { + PerformPixelationSafetyChecks(settings); + + // Return if not enough to draw anything. + if (positions.Length <= 2) + return; + + // Return if too many to draw anything, + if (positions.Length >= MaxPositions) + return; + + // IF this is false, a correct position trail could not be made and rendering should not continue. + if (!AssignPointsRectangleTrail(positions, settings, pointsToCreate ?? positions.Length)) + return; + + // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. + if (MainPositions.Length <= 2) + return; + + MainSettings = settings; + + AssignVerticesRectangleTrail(); + AssignIndicesRectangleTrail(); + + // Else render without wasting resources creating a set. + PrivateRender(); + return; + } + + private static void PrivateRender() + { + if (IndicesIndex % 6 != 0 || VerticesIndex <= 3) + return; + + // Perform screen culling, for performance reasons. + Main.instance.GraphicsDevice.RasterizerState = RasterizerState.CullNone; + Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; + Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); + + Matrix view; + Matrix projection; + if (MainSettings.Pixelate) + CalcuatePixelatedPerspectiveMatrices(out view, out projection); + else + CalamityUtils.CalculatePerspectiveMatricies(out view, out projection); + + var shaderToUse = MainSettings.Shader ?? GameShaders.Misc["CalamityMod:StandardPrimitiveShader"]; + shaderToUse.Shader.Parameters["uWorldViewProjection"].SetValue(view * projection); + shaderToUse.Apply(); + + VertexBuffer.SetData(MainVertices, 0, VerticesIndex, SetDataOptions.Discard); + IndexBuffer.SetData(MainIndices, 0, IndicesIndex, SetDataOptions.Discard); + + Main.instance.GraphicsDevice.SetVertexBuffer(VertexBuffer); + Main.instance.GraphicsDevice.Indices = IndexBuffer; + Main.instance.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, VerticesIndex, 0, IndicesIndex / 3); + } + #endregion + + #region Set Preperation + private static bool AssignPointsRectangleTrail(Vector2[] positions, PrimitiveSettings settings, int pointsToCreate) + { + // Don't smoothen the points unless explicitly told do so. + if (!settings.Smoothen) + { + PositionsIndex = 0; + + // Would like to remove this, but unsure how else to properly ensure that none are zero. + positions = positions.Where(originalPosition => originalPosition != Vector2.Zero).ToArray(); + + if (positions.Length <= 2) + return false; + + // Remap the original positions across a certain length. + for (int i = 0; i < pointsToCreate; i++) + { + float completionRatio = i / (float)(pointsToCreate - 1f); + int currentIndex = (int)(completionRatio * (positions.Length - 1)); + Vector2 currentPoint = positions[currentIndex]; + Vector2 nextPoint = positions[(currentIndex + 1) % positions.Length]; + + // 29FEB2024: Ozzatron: offset function needs to apply even in cases where smoothing is off. + Vector2 finalPos = Vector2.Lerp(currentPoint, nextPoint, completionRatio * (positions.Length - 1) % 0.99999f) - Main.screenPosition; + if (settings.OffsetFunction != null) + finalPos += settings.OffsetFunction(completionRatio); + + MainPositions[PositionsIndex] = finalPos; + PositionsIndex++; + } + return true; + } + + // Due to the first point being manually added, points should be added starting at the second position instead of the first. + PositionsIndex = 1; + + // Create the control points for the spline. + List controlPoints = new(); + for (int i = 0; i < positions.Length; i++) + { + // Don't incorporate points that are zeroed out. + // They are almost certainly a result of incomplete oldPos arrays. + if (positions[i] == Vector2.Zero) + continue; + + float completionRatio = i / (float)positions.Length; + Vector2 offset = -Main.screenPosition; + if (settings.OffsetFunction != null) + offset += settings.OffsetFunction(completionRatio); + controlPoints.Add(positions[i] + offset); + } + + // Avoid stupid index errors. + if (controlPoints.Count <= 4) + return false; + + for (int j = 0; j < pointsToCreate; j++) + { + float splineInterpolant = j / (float)pointsToCreate; + float localSplineInterpolant = splineInterpolant * (controlPoints.Count - 1f) % 1f; + int localSplineIndex = (int)(splineInterpolant * (controlPoints.Count - 1f)); + + Vector2 farLeft; + Vector2 left = controlPoints[localSplineIndex]; + Vector2 right = controlPoints[localSplineIndex + 1]; + Vector2 farRight; + + // Special case: If the spline attempts to access the previous/next index but the index is already at the very beginning/end, simply + // cheat a little bit by creating a phantom point that's mirrored from the previous one. + if (localSplineIndex <= 0) + { + Vector2 mirrored = left * 2f - right; + farLeft = mirrored; + } + else + farLeft = controlPoints[localSplineIndex - 1]; + + if (localSplineIndex >= controlPoints.Count - 2) + { + Vector2 mirrored = right * 2f - left; + farRight = mirrored; + } + else + farRight = controlPoints[localSplineIndex + 2]; + + MainPositions[PositionsIndex] = Vector2.CatmullRom(farLeft, left, right, farRight, localSplineInterpolant); + PositionsIndex++; + } + + // Manually insert the front and end points. + MainPositions[0] = controlPoints.First(); + MainPositions[PositionsIndex] = controlPoints.Last(); + PositionsIndex++; + return true; + } + + private static void AssignVerticesRectangleTrail() + { + VerticesIndex = 0; + for (int i = 0; i < PositionsIndex; i++) + { + float completionRatio = i / (float)(PositionsIndex - 1); + float widthAtVertex = MainSettings.WidthFunction(completionRatio); + Color vertexColor = MainSettings.ColorFunction(completionRatio); + Vector2 currentPosition = MainPositions[i]; + Vector2 directionToAhead = i == PositionsIndex - 1 ? (MainPositions[i] - MainPositions[i - 1]).SafeNormalize(Vector2.Zero) : (MainPositions[i + 1] - MainPositions[i]).SafeNormalize(Vector2.Zero); + + Vector2 leftCurrentTextureCoord = new(completionRatio, 0f); + Vector2 rightCurrentTextureCoord = new(completionRatio, 1f); + + // Point 90 degrees away from the direction towards the next point, and use it to mark the edges of the rectangle. + // This doesn't use RotatedBy for the sake of performance (there can potentially be a lot of trail points). + Vector2 sideDirection = new(-directionToAhead.Y, directionToAhead.X); + + Vector2 left = currentPosition - sideDirection * widthAtVertex; + Vector2 right = currentPosition + sideDirection * widthAtVertex; + + // Override the initial vertex positions if requested. + if (i == 0 && MainSettings.InitialVertexPositionsOverride.HasValue && MainSettings.InitialVertexPositionsOverride.Value.Item1 != Vector2.Zero && MainSettings.InitialVertexPositionsOverride.Value.Item2 != Vector2.Zero) + { + left = MainSettings.InitialVertexPositionsOverride.Value.Item1; + right = MainSettings.InitialVertexPositionsOverride.Value.Item2; + } + + // What this is doing, at its core, is defining a rectangle based on two triangles. + // These triangles are defined based on the width of the strip at that point. + // The resulting rectangles combined are what make the trail itself. + MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(left, vertexColor, leftCurrentTextureCoord); + VerticesIndex++; + MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(right, vertexColor, rightCurrentTextureCoord); + VerticesIndex++; + } + } + + private static void AssignIndicesRectangleTrail() + { + // What this is doing is basically representing each point on the vertices list as + // indices. These indices should come together to create a tiny rectangle that acts + // as a segment on the trail. This is achieved here by splitting the indices (or rather, points) + // into 2 triangles, which requires 6 points. + // The logic here basically determines which indices are connected together. + IndicesIndex = 0; + for (short i = 0; i < PositionsIndex - 2; i++) + { + short connectToIndex = (short)(i * 2); + MainIndices[IndicesIndex] = connectToIndex; + IndicesIndex++; + + MainIndices[IndicesIndex] = (short)(connectToIndex + 1); + IndicesIndex++; + + MainIndices[IndicesIndex] = (short)(connectToIndex + 2); + IndicesIndex++; + + MainIndices[IndicesIndex] = (short)(connectToIndex + 2); + IndicesIndex++; + + MainIndices[IndicesIndex] = (short)(connectToIndex + 1); + IndicesIndex++; + + MainIndices[IndicesIndex] = (short)(connectToIndex + 3); + IndicesIndex++; + } + } + + private static void CalcuatePixelatedPerspectiveMatrices(out Matrix viewMatrix, out Matrix projectionMatrix) + { + // Due to the scaling, the normal transformation calcuations do not work with pixelated primitives. + projectionMatrix = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -1, 1); + viewMatrix = Matrix.Identity; + } + #endregion + } +} diff --git a/Graphics/Primitives/PrimitiveSet.cs b/Graphics/Primitives/PrimitiveSet.cs deleted file mode 100644 index a911dd3b20..0000000000 --- a/Graphics/Primitives/PrimitiveSet.cs +++ /dev/null @@ -1,296 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; - -namespace CalamityMod.Graphics.Primitives -{ - /// - /// This both acts as an instanceable struct containing primitive trail data, and as a manager that creates and renders said instances.

- /// To use normally, in the draw method of an NPC or Projectile call .
- /// - /// The first param should be the positions to use for the trail. - /// The second is a struct that allows you to choose a desired configuration of settings to use with the trail, to allow for customization. - /// The third controls how many points are created for the trail, and the fourth determines whether the primitive is subsequently rendered. - /// If you do not render in , you MUST call manually on the created instance to make it actually appear. - /// - /// If you wish to use pixelation, you MUST make the NPC/Projectile inherit and use instead.
- /// You can also optionally specify a render layer with . It is by default. - ///
- public readonly struct PrimitiveSet - { - #region Instance Members - /// - /// The vertices of the set. - /// - public readonly VertexPosition2DColorTexture[] Vertices; - - /// - /// The indices of the set. - /// - public readonly int[] Indices; - - /// - /// The settings of the set. - /// - public readonly PrimitiveSettings Settings; - - private PrimitiveSet(VertexPosition2DColorTexture[] vertices, int[] indices, PrimitiveSettings settings) - { - Vertices = vertices; - Indices = indices; - Settings = settings; - } - #endregion - - #region Static Members - private static void PerformPixelationSafetyChecks(PrimitiveSettings settings) - { - // Don't allow accidental screw ups with these. - if (settings.Pixelate && !PrimitivePixelationSystem.CurrentlyRendering) - throw new Exception("Error: Primitives using pixelation MUST be prepared/rendered from the IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives method, did you forget to use the interface?"); - else if (!settings.Pixelate && PrimitivePixelationSystem.CurrentlyRendering) - throw new Exception("Error: Primitives not using pixelation MUST NOT be prepared/rendered from the IPixelatedPrimitiveRenderer.RenderPixelatedPrimitives method."); - } - - /// - /// Prepares a based on the provided information, and optionally renders it. - /// - /// The list of positions to use. Keep in mind that these are expected to be in world position, and is automatically subtracted from them all. - /// The primitive draw settings to use. - /// The amount of points to use. More is higher detailed, but less performant. By default, is the number of positions provided. Going above 100 is NOT recommended. - /// Whether to render the set. - /// The prepared set. - public static PrimitiveSet? Prepare(IEnumerable positions, PrimitiveSettings settings, int? pointsToCreate = null, bool render = true) - { - PerformPixelationSafetyChecks(settings); - - int positionCount = positions.Count(); - - // Return if not enough to draw anything. - if (positionCount <= 2) - return null; - - // Cull out any zeroed points. - positions = positions.Where(p => p != Vector2.Zero); - List trailPoints = PreparePointsRectangleTrail(positions, settings, pointsToCreate ?? positionCount).ToList(); - - // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. - if (trailPoints.Count <= 2) - return null; - - // If the trail point has any NaN positions, don't draw anything. - if (trailPoints.Any(point => point.HasNaNs())) - return null; - - // If the trail points are all equal, don't draw anything. - if (trailPoints.All(point => point == trailPoints[0])) - return null; - - IEnumerable vertices = CreateVerticesRectangleTrail(trailPoints.ToList(), settings); - int[] indices = CreateIndicesRectangleTrail(trailPoints.Count); - - // Create the set, and just return it if not asked to render. - PrimitiveSet set = new(vertices.ToArray(), indices, settings); - if (!render) - return set; - - // Else render the set and return it. - return set.Render(); - } - #endregion - - #region Instance Methods - /// - /// Renders the provided primitive set to the screen. - /// - /// The provided set. - public PrimitiveSet Render() - { - PerformPixelationSafetyChecks(Settings); - - if (Indices.Length % 6 != 0 || Vertices.Length <= 3) - return this; - - // Perform screen culling, for performance reasons. - Main.instance.GraphicsDevice.RasterizerState = RasterizerState.CullNone; - Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; - Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); - - Matrix view; - Matrix projection; - if (Settings.Pixelate) - CalcuatePixelatedPerspectiveMatrices(out view, out projection); - else - CalamityUtils.CalculatePerspectiveMatricies(out view, out projection); - - var shaderToUse = Settings.Shader ?? GameShaders.Misc["CalamityMod:StandardPrimitiveShader"]; - shaderToUse.Shader.Parameters["uWorldViewProjection"].SetValue(view * projection); - shaderToUse.Apply(); - - // Render the set. - Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, Vertices, 0, Vertices.Length, Indices, 0, Indices.Length / 3); - Main.pixelShader.CurrentTechnique.Passes[0].Apply(); - return this; - } - #endregion - - #region Set Preperation - private static IEnumerable PreparePointsRectangleTrail(IEnumerable positions, PrimitiveSettings settings, int pointsToCreate) - { - // Don't smoothen the points unless explicitly told do so. - if (!settings.Smoothen) - { - List basePoints = positions.Where(originalPosition => originalPosition != Vector2.Zero).ToList(); - List endPoints = new(); - - if (basePoints.Count <= 2) - return endPoints; - - // Remap the original positions across a certain length. - for (int i = 0; i < pointsToCreate; i++) - { - float completionRatio = i / (float)(pointsToCreate - 1f); - int currentIndex = (int)(completionRatio * (basePoints.Count - 1)); - Vector2 currentPoint = basePoints[currentIndex]; - Vector2 nextPoint = basePoints[(currentIndex + 1) % basePoints.Count]; - endPoints.Add(Vector2.Lerp(currentPoint, nextPoint, completionRatio * (basePoints.Count - 1) % 0.99999f) - Main.screenPosition); - } - return endPoints; - } - - List controlPoints = new(); - for (int i = 0; i < positions.Count(); i++) - { - // Don't incorporate points that are zeroed out. - // They are almost certainly a result of incomplete oldPos arrays. - if (positions.ElementAt(i) == Vector2.Zero) - continue; - - float completionRatio = i / (float)positions.Count(); - Vector2 offset = -Main.screenPosition; - if (settings.OffsetFunction != null) - offset += settings.OffsetFunction(completionRatio); - controlPoints.Add(positions.ElementAt(i) + offset); - } - List points = new(); - - // Avoid stupid index errors. - if (controlPoints.Count <= 4) - return controlPoints; - - for (int j = 0; j < pointsToCreate; j++) - { - float splineInterpolant = j / (float)pointsToCreate; - float localSplineInterpolant = splineInterpolant * (controlPoints.Count - 1f) % 1f; - int localSplineIndex = (int)(splineInterpolant * (controlPoints.Count - 1f)); - - Vector2 farLeft; - Vector2 left = controlPoints[localSplineIndex]; - Vector2 right = controlPoints[localSplineIndex + 1]; - Vector2 farRight; - - // Special case: If the spline attempts to access the previous/next index but the index is already at the very beginning/end, simply - // cheat a little bit by creating a phantom point that's mirrored from the previous one. - if (localSplineIndex <= 0) - { - Vector2 mirrored = left * 2f - right; - farLeft = mirrored; - } - else - farLeft = controlPoints[localSplineIndex - 1]; - - if (localSplineIndex >= controlPoints.Count - 2) - { - Vector2 mirrored = right * 2f - left; - farRight = mirrored; - } - else - farRight = controlPoints[localSplineIndex + 2]; - - points.Add(Vector2.CatmullRom(farLeft, left, right, farRight, localSplineInterpolant)); - } - - // Manually insert the front and end points. - points.Insert(0, controlPoints.First()); - points.Add(controlPoints.Last()); - - return points; - } - - private static IEnumerable CreateVerticesRectangleTrail(List positions, PrimitiveSettings settings) - { - List vertices = new(); - - for (int i = 0; i < positions.Count; i++) - { - float completionRatio = i / (float)(positions.Count - 1); - float widthAtVertex = settings.WidthFunction(completionRatio); - Color vertexColor = settings.ColorFunction(completionRatio); - Vector2 currentPosition = positions[i]; - Vector2 directionToAhead = i == positions.Count - 1 ? (positions[i] - positions[i - 1]).SafeNormalize(Vector2.Zero) : (positions[i + 1] - positions[i]).SafeNormalize(Vector2.Zero); - - Vector2 leftCurrentTextureCoord = new(completionRatio, 0f); - Vector2 rightCurrentTextureCoord = new(completionRatio, 1f); - - // Point 90 degrees away from the direction towards the next point, and use it to mark the edges of the rectangle. - // This doesn't use RotatedBy for the sake of performance (there can potentially be a lot of trail points). - Vector2 sideDirection = new(-directionToAhead.Y, directionToAhead.X); - - Vector2 left = currentPosition - sideDirection * widthAtVertex; - Vector2 right = currentPosition + sideDirection * widthAtVertex; - - // Override the initial vertex positions if requested. - if (i == 0 && settings.InitialVertexPositionsOverride.HasValue && settings.InitialVertexPositionsOverride.Value.Item1 != Vector2.Zero && settings.InitialVertexPositionsOverride.Value.Item2 != Vector2.Zero) - { - left = settings.InitialVertexPositionsOverride.Value.Item1; - right = settings.InitialVertexPositionsOverride.Value.Item2; - } - - // What this is doing, at its core, is defining a rectangle based on two triangles. - // These triangles are defined based on the width of the strip at that point. - // The resulting rectangles combined are what make the trail itself. - vertices.Add(new VertexPosition2DColorTexture(left, vertexColor, leftCurrentTextureCoord)); - vertices.Add(new VertexPosition2DColorTexture(right, vertexColor, rightCurrentTextureCoord)); - } - - return vertices; - } - - private static int[] CreateIndicesRectangleTrail(int pointCount) - { - // What this is doing is basically representing each point on the vertices list as - // indices. These indices should come together to create a tiny rectangle that acts - // as a segment on the trail. This is achieved here by splitting the indices (or rather, points) - // into 2 triangles, which requires 6 points. - // The logic here basically determines which indices are connected together. - int totalIndices = (pointCount - 1) * 6; - int[] indices = new int[totalIndices]; - - for (int i = 0; i < pointCount - 2; i++) - { - int startingTriangleIndex = i * 6; - int connectToIndex = i * 2; - indices[startingTriangleIndex] = connectToIndex; - indices[startingTriangleIndex + 1] = connectToIndex + 1; - indices[startingTriangleIndex + 2] = connectToIndex + 2; - indices[startingTriangleIndex + 3] = connectToIndex + 2; - indices[startingTriangleIndex + 4] = connectToIndex + 1; - indices[startingTriangleIndex + 5] = connectToIndex + 3; - } - - return indices; - } - - private static void CalcuatePixelatedPerspectiveMatrices(out Matrix viewMatrix, out Matrix projectionMatrix) - { - // Due to the scaling, the normal transformation calcuations do not work with pixelated primitives. - projectionMatrix = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -1, 1); - viewMatrix = Matrix.Identity; - } - #endregion - } -} diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index e55bc7219c..9e37510053 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 6df9d42ad7..5e4afd6152 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -42,6 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index be8c84a865..037f0b5d8f 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 5c46370b67..518c88f91d 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 26ea1f837a..1e1fdadaec 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 24a0371eb1..3ebfabf130 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -56,6 +56,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToWater = false; NPC.Calamity().canBreakPlayerDefense = true; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 5fde6274e9..072f602272 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index b4097eee78..7e4b4c42a8 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -59,6 +59,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 1c49679aff..847dadb2f4 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index f043e8d576..76980e727e 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 6f0b9683f6..85821afc52 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 3fdeb28bc5..8e4474c31d 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -74,6 +74,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 09ac8c8c0e..4a4f992355 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 28daa6ca09..0acb14f099 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index d731150336..53c3d820b8 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 47e16dc518..c98c6889b4 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 20c79ee621..548ce25fa2 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -64,6 +64,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 50decee7f6..bea4137fa0 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 760439ff8b..7bb317550c 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 63e585fa2f..4b20557042 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index dbf83b9231..a9c9930525 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -55,6 +55,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 559ec60211..35c2d095df 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 80e39a503e..631f52343f 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 9ce66de0a2..7cd92d5956 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -59,6 +59,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 50bf540ba5..6d3cb0f39f 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index 945e623b6f..54383b3269 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -61,10 +61,13 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + if (Main.zenithWorld) // legg - { NPC.height = (int)(NPC.height * 1.5f); - } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index c556bfb721..71f49671b7 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -69,6 +69,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToWater = false; NPC.GravityIgnoresLiquid = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 151070a799..b0cde6ca15 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 5af5800692..e89c83f727 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index bb9ad9f7bc..394258be56 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -74,6 +74,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -230,7 +234,7 @@ namespace CalamityMod.NPCs.AcidRain Vector2 tailDrawPosition = segmentPositions[^1] - tailRotation.ToRotationVector2() * 4f; SpriteEffects tailDirection = NPC.velocity.X < 0f ? SpriteEffects.None : SpriteEffects.FlipVertically; Main.EntitySpriteDraw(tailTexture, tailDrawPosition, tailArea, NPC.GetAlpha(Color.White), tailRotation, tailArea.Size() * new Vector2(0f, 0.5f), NPC.scale, tailDirection, 0); - PrimitiveSet.Prepare(segmentPositions, new(SegmentWidthFunction, _ => NPC.GetAlpha(Color.White), pixelate: false, shader: GameShaders.Misc["CalamityMod:PrimitiveTexture"]), 36); + PrimitiveRenderer.RenderTrail(segmentPositions, new(SegmentWidthFunction, _ => NPC.GetAlpha(Color.White), pixelate: false, shader: GameShaders.Misc["CalamityMod:PrimitiveTexture"]), 36); } return false; diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index eb6d9ee61d..d020a25082 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -60,6 +60,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 22d3e5a17a..80e607519e 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -58,6 +58,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 1a20233211..c710c50361 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 220; NPC.defense = 5; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; AIType = NPCID.ToxicSludge; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 069c5c44e3..e3a212cb44 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -83,6 +83,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 8b36b27fd9..aee822f57e 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -71,6 +71,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 5cb0b0a282..768927b02d 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 10; } - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.lavaImmune = false; NPC.noGravity = false; @@ -56,6 +56,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 07652269dd..4549bcf106 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -69,6 +69,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 992c348b82..93f362ae39 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -66,6 +66,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 82b8f4101b..f50efa9233 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -62,6 +62,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index d91bae8a06..19909ceb51 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index e9a76c936c..2f0e99b533 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 83ab0cdb41..e7a19a0c18 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = NPCAIStyleID.Slime; NPC.defense = 8; NPC.lifeMax = 200; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.6f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 60; NPC.HitSound = SoundID.NPCHit1; @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 53dec08e7d..3932e26f5d 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Astral } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 4038b79a2d..8199136f8e 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -59,6 +59,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 94dee4bc62..48457632ea 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -154,6 +154,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 6ced21f8ba..284fda003d 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -76,6 +76,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public static bool ValidMovementPosition(Tile tile) diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 633a5eb81f..fdbea139a5 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -59,6 +59,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index d39229825e..fec00f84d9 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -55,6 +55,10 @@ namespace CalamityMod.NPCs.Astral { NPC.scale = 3f; } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 2d49bc63f5..900f56d6b9 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 63e6be2c55..792431688d 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -61,6 +61,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index a3edd9fd79..7328f96740 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -82,6 +82,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 23e0fe3d75..1d3249cdd2 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -60,6 +60,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index ae79b7a9c4..7c705df289 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -62,6 +62,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 5c5cad3c7c..6d62c05ab8 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -60,6 +60,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = 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) diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index cafe6c2935..a983423648 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.defense = 0; NPC.DR_NERD(normalDR); NPC.lifeMax = 1000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 15dc624203..57e33046f2 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.Bumblebirb 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() diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index aedd5d42f2..9123593666 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.CalClone NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2df1b421ec..ea7c92c5d3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -158,6 +158,14 @@ namespace CalamityMod.NPCs // Used to nerf desert prehardmode enemies pre-Desert Scourge private const double DesertEnemyStatMultiplier = 0.75; + // Used to nerf Master Mode enemies + public const double MasterModeEnemyHPMultiplier = 0.75; + public const double MasterModeEnemyDamageMultiplier = 0.85; + + // Used to nerf Expert and Master Mode enemies + public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; + public const float MasterModeEnemyKnockbackMultiplier = 0.1f; + // Used to increase coin drops in Normal Mode private const double NPCValueMultiplier_NormalCalamity = 1.5; @@ -2485,14 +2493,7 @@ namespace CalamityMod.NPCs // Nerf KB resist in Expert and Master using this roundabout method if (Main.expertMode) - { - if (npc.knockBackResist > 0f && npc.knockBackResist < 1f) - { - float knockBackResistMult = Main.masterMode ? 0.1f : 0.05f; - float knockBackResistReduction = MathHelper.Clamp((1f - npc.knockBackResist) * knockBackResistMult, 0f, npc.knockBackResist - 0.01f); - npc.knockBackResist -= knockBackResistReduction; - } - } + 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) @@ -2991,8 +2992,9 @@ namespace CalamityMod.NPCs case NPCID.DD2WyvernT1: case NPCID.DD2WyvernT2: case NPCID.DD2WyvernT3: - npc.lifeMax = (int)(npc.lifeMax * 0.75); - npc.damage = (int)(npc.damage * 0.85); + case NPCID.AncientCultistSquidhead: + case NPCID.SlimeSpiked: + AdjustMasterModeStatScaling(npc); npc.defDamage = npc.damage; break; } @@ -7714,5 +7716,31 @@ namespace CalamityMod.NPCs return null; } #endregion + + #region Adjust Difficulty Stat Scaling + // Adjust HP and damage in Master Mode + public static void AdjustMasterModeStatScaling(NPC npc) + { + if (!Main.masterMode) + return; + + npc.lifeMax = (int)(npc.lifeMax * MasterModeEnemyHPMultiplier); + npc.damage = (int)(npc.damage * MasterModeEnemyDamageMultiplier); + } + + // Adjust only knockback resist in Expert Mode (this is also adjusted in Master Mode because Expert has to be enabled if Master is enabled) + public static void AdjustExpertModeStatScaling(NPC npc) + { + if (!Main.expertMode) + return; + + if (npc.knockBackResist <= 0f || npc.knockBackResist >= 1f) + return; + + float knockBackResistMult = Main.masterMode ? MasterModeEnemyKnockbackMultiplier : ExpertModeEnemyKnockbackMultiplier; + float knockBackResistReduction = MathHelper.Clamp((1f - npc.knockBackResist) * knockBackResistMult, 0f, npc.knockBackResist - 0.01f); + npc.knockBackResist -= knockBackResistReduction; + } + #endregion } } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index c3b1293d62..ed815e8996 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -242,6 +242,7 @@ namespace CalamityMod.NPCs "Kiriku", // <@!395312478160027668> (rulosss#6814) "Lacuna", // <@!790746689211203604> (_lacuna_) "Mae Borowski", //<@!219158690433990656> (justakkolite) + "Jackie", // <@!353241811717718016> (jackalchan) }; // The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies. diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index e85fb21088..b7f04b99dc 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index d3ba88006c..730635427e 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.Crabulon NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index f9a218898c..5ee0f09e36 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 140; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; @@ -47,6 +47,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index e74164307d..b26c85bc46 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Crags NPC.defense = 38; NPC.DR_NERD(0.35f); NPC.lifeMax = 120; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; @@ -55,6 +55,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index 8b44f2ca37..f2837be0e0 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index db18089d1f..20431b2b8d 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 30; NPC.defense = 10; NPC.lifeMax = 250; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.alpha = 50; @@ -48,6 +48,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index b11ff91c0d..59e6fa94ec 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index a39b02866f..779cc3ccd6 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -53,6 +53,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 8cff9fab19..6fa5a79a6f 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 30d8aba7ce..b0b66cabb8 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 25c15b3f4e..55d3b639b5 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 96fe39f8c5..28f9ad9e90 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -58,6 +58,10 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index bc543cfe64..eebc906c3c 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -42,6 +42,10 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 7e1a4bc4f9..40f2bf40b0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -402,7 +402,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f; + return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f && invinceTime <= 0; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 7d5e03ca02..3eaa0195f8 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -949,6 +949,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fly to the right of the target case (int)Phase.Normal: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1022,6 +1025,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge case (int)Phase.RocketBarrage: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1063,6 +1069,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Create telegraph beams between the charge location array positions case (int)Phase.LineUpChargeCombo: + // Avoid cheap bullshit + NPC.damage = 0; + if (!readyToCharge) { // Smooth movement towards the location Apollo is meant to be at @@ -1124,6 +1133,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= timeToLineUpCharge) { + // Set damage + NPC.damage = NPC.defDamage; + ExoMechsSky.CreateLightningBolt(10); AIState = (float)Phase.ChargeCombo; @@ -1137,6 +1149,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge to several locations almost instantly (Apollo doesn't teleport here, he's just moving very fast :D) case (int)Phase.ChargeCombo: + // Set damage + NPC.damage = NPC.defDamage; + // Tell Artemis to not fire lasers for a short time NPC.ai[3] = 61f; @@ -1240,6 +1255,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Reset phase and variables if (calamityGlobalNPC.newAI[2] >= maxCharges - 1) { + // Avoid cheap bullshit + NPC.damage = 0; + if (Main.zenithWorld && !exoMechdusa) { pickNewLocation = NPC.localAI[2] == 0f; @@ -1277,6 +1295,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1360,7 +1381,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.ChargeCombo; + return minDist <= 100f && NPC.Opacity == 1f; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1553,7 +1574,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo currentSegmentRotation += segmentRotationOffset; } - PrimitiveSet.Prepare(ribbonDrawPositions, new(RibbonTrailWidthFunction, RibbonTrailColorFunction), 66); + PrimitiveRenderer.RenderTrail(ribbonDrawPositions, new(RibbonTrailWidthFunction, RibbonTrailColorFunction), 66); } int instanceCount = (int)MathHelper.Lerp(1f, 15f, ChargeComboFlash); @@ -1618,11 +1639,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo for (int i = 0; i < 4; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 8f; - PrimitiveSet.Prepare(drawPositions, new(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, (_) => drawOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); + PrimitiveRenderer.RenderTrail(drawPositions, new(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, (_) => drawOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); } } else - PrimitiveSet.Prepare(drawPositions, new(FlameTrailWidthFunction, FlameTrailColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); + PrimitiveRenderer.RenderTrail(drawPositions, new(FlameTrailWidthFunction, FlameTrailColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); } } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 2d8c35b838..b9dc07c33f 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1328,13 +1328,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.Opacity > 0f && !NPC.IsABestiaryIconDummy) { List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(armSegmentDrawPosition, arm2DrawPosition + arm2Rotation.ToRotationVector2() * -direction * 20f, 250290787); - PrimitiveSet.Prepare(arm2ElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(arm2ElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arm2ElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arm2ElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); // Draw electricity between the final arm and the hand. List handElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm2DrawPosition - arm2Rotation.ToRotationVector2() * direction * 100f, handPosition, 27182); - PrimitiveSet.Prepare(handElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(handElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(handElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(handElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); } shoulderDrawPosition += Vector2.UnitY * NPC.gfxOffY - screenOffset; @@ -1390,13 +1390,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.Opacity > 0f && !NPC.IsABestiaryIconDummy) { List arm2ElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm1DrawPosition - arm2Rotation.ToRotationVector2() * direction * 10f, arm1DrawPosition + arm2Rotation.ToRotationVector2() * direction * 20f, 31416); - PrimitiveSet.Prepare(arm2ElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(arm2ElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arm2ElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arm2ElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); // Draw electricity between the final arm and the hand. List handElectricArcPoints = AresTeslaOrb.DetermineElectricArcPoints(arm2DrawPosition - arm2Rotation.ToRotationVector2() * direction * 20f, handPosition, 27182); - PrimitiveSet.Prepare(handElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(handElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(handElectricArcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(handElectricArcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); } shoulderDrawPosition += Vector2.UnitY * NPC.gfxOffY - screenOffset; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 397b881b92..d42f25aa28 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -724,6 +724,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly to the left of the target case (int)Phase.Normal: + // Avoid cheap bullshit + NPC.damage = 0; + if (!stopRotatingAndSlowDown) { // Set charge variable to default @@ -859,6 +862,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } else { + // Set damage + NPC.damage = NPC.defDamage; + // Charge until a certain distance is reached and then return to normal phase SoundEngine.PlaySound(ChargeSound, NPC.Center); AIState = (float)Phase.Charge; @@ -877,6 +883,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Charge case (int)Phase.Charge: + // Set damage + NPC.damage = NPC.defDamage; + // Allow the charge flash to happen shouldDoChargeFlash = true; @@ -884,6 +893,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= chargeDuration) { + // Avoid cheap bullshit + NPC.damage = 0; + // Decelerate NPC.velocity *= decelerationVelocityMult; @@ -901,6 +913,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser shotgun barrage case (int)Phase.LaserShotgun: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Artemis is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -961,6 +976,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fly above target, fire deathray and move in a circle around the target case (int)Phase.Deathray: + // Avoid cheap bullshit + NPC.damage = 0; + // Fly above, stop doing this if in the proper position // Stop rotating and spin around a target point if ((destination - NPC.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) @@ -1178,6 +1196,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase transition animation, that's all this exists for case (int)Phase.PhaseTransition: + // Avoid cheap bullshit + NPC.damage = 0; + // Smooth movement towards the location Artemis is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -1255,7 +1276,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (hitboxBotRight < minDist) minDist = hitboxBotRight; - return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.Charge; + return minDist <= 100f && NPC.Opacity == 1f; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -1448,7 +1469,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis currentSegmentRotation += segmentRotationOffset; } - PrimitiveSet.Prepare(ribbonDrawPositions, new(RibbonTrailWidthFunction, RibbonTrailColorFunction), 66); + PrimitiveRenderer.RenderTrail(ribbonDrawPositions, new(RibbonTrailWidthFunction, RibbonTrailColorFunction), 66); } int instanceCount = (int)MathHelper.Lerp(1f, 15f, ChargeFlash); @@ -1513,11 +1534,11 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis for (int i = 0; i < 4; i++) { Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 8f; - PrimitiveSet.Prepare(drawPositions, new(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, (_) => drawOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); + PrimitiveRenderer.RenderTrail(drawPositions, new(FlameTrailWidthFunctionBig, FlameTrailColorFunctionBig, (_) => drawOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); } } else - PrimitiveSet.Prepare(drawPositions, new(FlameTrailWidthFunction, FlameTrailColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); + PrimitiveRenderer.RenderTrail(drawPositions, new(FlameTrailWidthFunction, FlameTrailColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 70); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 0e472b9f17..8a0dba7614 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -169,7 +169,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -470,7 +471,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -482,31 +483,72 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 4aef9895cb..ddb8ed59b3 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -167,7 +167,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -470,7 +471,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -482,33 +483,74 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 0e4df1faa6..03543f43b5 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1010,6 +1010,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } } + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + { + NPC.damage = (int)(NPC.defDamage * 0.5f); + } + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 9d1a13f9a8..31254ed0ff 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -167,7 +167,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Set vulnerable to false by default vulnerable = false; - CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)NPC.ai[2]].Calamity(); + NPC head = Main.npc[(int)NPC.ai[2]]; + CalamityGlobalNPC calamityGlobalNPC_Head = head.Calamity(); bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; @@ -468,7 +469,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Player player = Main.player[head.target]; Vector2 npcCenter = NPC.Center; float targetCenterX = player.Center.X; @@ -480,33 +481,74 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos targetCenterX -= npcCenter.X; targetCenterY -= npcCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + float newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try { - npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X; - targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y; + npcCenter = NPC.Center; + targetCenterX = Main.npc[(int)NPC.ai[1]].Center.X - npcCenter.X; + targetCenterY = Main.npc[(int)NPC.ai[1]].Center.Y - npcCenter.Y; } catch { } NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2; - distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); - distanceFromTarget = (distanceFromTarget - NPC.width) / distanceFromTarget; - targetCenterX *= distanceFromTarget; - targetCenterY *= distanceFromTarget; + newPosition = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY); + newPosition = (newPosition - NPC.width) / newPosition; + targetCenterX *= newPosition; + targetCenterY *= newPosition; NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetCenterX; - NPC.position.Y = NPC.position.Y + targetCenterY; + NPC.position.X += targetCenterX; + NPC.position.Y += targetCenterY; if (targetCenterX < 0f) NPC.spriteDirection = -1; else if (targetCenterX > 0f) NPC.spriteDirection = 1; } + + bool speedUp = head.localAI[3] < 180f; + + // Distance from target + float distanceFromTarget = Vector2.Distance(head.Center, speedUp ? (player.Center + new Vector2(0f, 2400f)) : player.Center); + + // Increase speed if too far from target + float increaseSpeedMult = 1f; + float increaseSpeedGateValue = 600f; + if (distanceFromTarget > increaseSpeedGateValue) + { + float distanceAmount = MathHelper.Clamp((distanceFromTarget - increaseSpeedGateValue) / (CalamityGlobalNPC.CatchUpDistance350Tiles - increaseSpeedGateValue), 0f, 1f); + increaseSpeedMult = MathHelper.Lerp(1f, 3.5f, distanceAmount); + } + + // Velocity and turn speed values + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocity = 10f * baseVelocityMult; + + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (player.dead || speedUp) + baseVelocity *= 4f; + else + baseVelocity *= increaseSpeedMult; + + if (Main.getGoodWorld) + baseVelocity *= 1.15f; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = baseVelocity * 0.25f; + float minimalDamageVelocity = baseVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + { + NPC.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 7cd054d46e..5b8c406d53 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -48,6 +48,10 @@ namespace CalamityMod.NPCs.HiveMind 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() diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 2413b84c8b..42c68b794a 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.HiveMind double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 3ea58117c5..ac4aec61da 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.HiveMind double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AIType = -1; NPC.noGravity = true; NPC.noTileCollide = true; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index b217da4504..82885fc36f 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Leviathan } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) NPC.scale *= 1.3f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 2055ca0032..45ce3a6124 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 6; NPC.lifeMax = 50; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; AnimationType = NPCID.Slimer; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.alpha = 50; @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 7e05de5b4b..17831bb71b 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 4c8ee48625..6b423c6129 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 5c1e7613ac..5b77f67c6d 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index 62fb80b095..85480340c5 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 7ec1803b35..da4b4bfaf0 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 25; NPC.lifeMax = 1000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 25, 0); NPC.alpha = 50; @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index d180a3b4da..68c3582f54 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -32,6 +32,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index dfaeeabfad..216a4edcde 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -47,6 +47,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index f62413f82e..9333fa56dd 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 501c4a563c..6109809617 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 883d4b05d5..f90f0c6d88 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index db2165f6ca..b5c103278c 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 2d643dd3f7..982d5b5027 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index cf84859eb4..9c03ee3ba8 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index b0a1e1b3fc..2f61eac7b6 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 8350888269..a5d17eb520 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 586542c5b0..ba146d6e4c 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 64140f4669..7c5c2a66ed 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 8; NPC.lifeMax = 120; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.6f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.alpha = 50; @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 8b3101c41f..28a4efa960 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 10; NPC.DR_NERD(0.1f); NPC.lifeMax = 300; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.4f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index b06adc0205..033f26faf7 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 60fd21977f..20ed4da9d8 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 80; NPC.lifeMax = 5000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.Opacity = 0f; NPC.noGravity = true; @@ -56,6 +56,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 5be646d307..6b730dc634 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index bf65e567e3..2cabc312e1 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 735d44cf89..6490d7d371 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 3800; NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.05f; NPC.value = Item.buyPrice(0, 1, 50, 0); NPC.dontTakeDamage = true; NPC.noGravity = true; @@ -55,6 +55,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index 650ca1053c..8c20cdf938 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -96,6 +96,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index bb8e621808..a33339fc4f 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 6aafd1eed9..f0fbe1a540 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.NormalNPCs double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 94c3c8989a..15eb09e912 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index b907d07b38..b8f2054310 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 18; NPC.DR_NERD(0.15f); NPC.lifeMax = NPC.downedMoonlord ? 1350 : 135; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit2; NPC.DeathSound = SoundID.NPCDeath2; @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 8971e1f59a..ab9ed0501a 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 150; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 50; @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 20d55ec11b..ba3117f6a7 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 16; NPC.defense = 10; NPC.lifeMax = 1000; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.2f; AnimationType = NPCID.DungeonSpirit; AIType = -1; NPC.value = Item.buyPrice(0, 0, 20, 0); @@ -36,6 +36,10 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index e479b31e35..cc889275e8 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.scale *= 1.2f; NPC.defense = 30; NPC.lifeMax = 3000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 60, 0); NPC.HitSound = SoundID.NPCHit36; @@ -42,6 +42,10 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 34b6445f28..4b9a8e4dec 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.scale *= 1.1f; NPC.defense = 25; NPC.lifeMax = 2000; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 40, 0); NPC.HitSound = SoundID.NPCHit36; @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index a0283303b3..6edfd13ae9 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.defense = 20; NPC.lifeMax = 1500; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0.2f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); NPC.HitSound = SoundID.NPCHit36; @@ -37,6 +37,10 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index a570ad812f..51f8a33426 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 278dfb1b29..27ff77c564 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 24c6de6f02..62242cd86d 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index eadd73b77c..4e800c0d76 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -33,6 +33,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 055997871d..4a79296582 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 38; NPC.DR_NERD(0.05f); NPC.lifeMax = 9000; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.1f; AIType = -1; NPC.lavaImmune = true; NPC.value = Item.buyPrice(0, 0, 50, 0); @@ -53,6 +53,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index 83147048bc..b031da27b0 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -31,6 +31,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index ad785c528c..b9b4d33249 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 150; NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 7742f4f83c..38ddf7e5c5 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 763dfef30a..a69bbd541c 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -47,6 +47,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index e0bc165f91..32613e2226 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -81,6 +81,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; NPC.Calamity().VulnerableToHeat = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 73d59a4330..ec7ca83ab6 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.defense = 20; NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; NPC.lavaImmune = true; NPC.noTileCollide = true; NPC.noGravity = true; @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 24f35022e2..5519d7528c 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -61,6 +61,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 1.5f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 14d981c93f..943c4bfc7a 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -81,6 +81,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 73387e19b9..adb4b9b685 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -64,6 +64,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index f86b305deb..4317f7591e 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -88,6 +88,10 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 8e3aea6473..bbaee7f27e 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -68,6 +68,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 2f; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index bcb1b17182..35ed340665 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.OldDuke } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath11; NPC.chaseable = false; @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index fdc0bb4918..b6e76517ec 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 468dd7364d..1ceb9b39c9 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 5838798d65..54d6e836e1 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -62,6 +62,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 42c732d312..e71b43f432 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 9edd39bb55..4ba795dcf7 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -75,6 +75,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 6a9930b72a..79827c6771 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -73,6 +73,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index ddcdf67196..1f6bb5cc30 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -74,6 +74,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 3781246482..fc9e8bd7bb 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index ba8b1a648d..bc0407001e 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -62,6 +62,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index fe1f0f2231..8743d2d114 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index caeb92beda..bd097cbde3 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 34; NPC.defense = 15; NPC.lifeMax = 500; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; Banner = NPC.type; @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index 39692b4fb7..d7517e2af0 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 12; NPC.lifeMax = 350; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 60; @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index f5ccf53b27..1c04b6fbaf 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.lifeMax = 200; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.4f; AnimationType = NPCID.Bee; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit4; @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index dd721e051c..c6b4e66b75 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.lifeMax = 300; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; AnimationType = NPCID.Bee; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit4; @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 8cac4c1209..69ee91d145 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -61,6 +61,10 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.scale = 2f; } + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 0a71551f33..aba2edda2f 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index a795ca4a72..47819df894 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 44; NPC.defense = 18; NPC.lifeMax = 400; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit22; Banner = NPC.type; @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index c7171f9679..7320b57fde 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.noTileCollide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 43f55b7f1f..2b708fd477 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.2f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index d4d37acb17..76a9932dc8 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -71,6 +71,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 5cbaeaee18..84a73540f9 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -81,6 +81,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 855cc1f2b9..c461cfb7e3 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 927f30808b..2eb3d39ecc 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 95308a1ce1..055acf1bf4 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 91d8f5bd07..f5734341db 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -40,6 +40,10 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 21cb520b4c..27c43336b8 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -53,6 +53,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index f4af1c76a1..6194b94953 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -53,6 +53,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 2105994f36..110acd3552 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index d4be36c7c2..3574de8db4 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 826baf193b..3d86d0d59c 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 078e485d27..aca0683f79 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.Ravager NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 4dd1aa8c47..0cf9a90c1d 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -38,6 +38,10 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 99634273db..469445932f 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.Signus NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index eb5901001c..0e466f5b0b 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -32,13 +32,17 @@ namespace CalamityMod.NPCs.Signus NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.dontTakeDamage = true; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 024f276a1f..99b8bda2ff 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 360 : 180; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.7f; AnimationType = 121; NPC.Opacity = 0.8f; NPC.lavaImmune = false; @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index 0872a46d22..987d70291f 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 90; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; NPC.Opacity = 0.8f; NPC.lavaImmune = false; @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index c3f09f130e..3f10a1281c 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 220 : 110; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; NPC.Opacity = 0.8f; NPC.lavaImmune = false; @@ -42,6 +42,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 5fed1908a2..bd512d28b5 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 260 : 130; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.7f; NPC.Opacity = 0.8f; NPC.lavaImmune = false; NPC.noGravity = false; diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index efa4bb6e61..bfbfad4f9f 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -49,6 +49,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index 648d3efd81..57b90345a5 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -46,6 +46,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 96274e03dc..4997ec5000 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -48,6 +48,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 46466e36cc..f892ce143d 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index 899c01d5fb..b34c98bd2c 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 422ba8de9a..675f63a5cb 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -43,6 +43,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index 2130b34cb9..dd1c4000d4 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.value = Item.buyPrice(0, 0, 3, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath5; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.15f; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 6638b102be..f94f36cdb3 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -44,6 +44,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 2d5b018b67..3ab87b9bfd 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - NPC.damage = 30; + NPC.damage = Main.hardMode ? 60 : 30; NPC.width = 56; NPC.height = 38; NPC.defense = 9999; @@ -50,6 +50,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -94,13 +98,8 @@ namespace CalamityMod.NPCs.SunkenSea { if (!statChange) { - NPC.defense = 6; - NPC.damage = Main.expertMode ? 60 : 30; - if (Main.hardMode) - { - NPC.defense = 15; - NPC.damage = Main.expertMode ? 120 : 60; - } + NPC.defense = Main.hardMode ? 15 : 6; + NPC.damage = NPC.defDamage; statChange = true; } if (NPC.ai[0] == 0f) @@ -175,9 +174,7 @@ namespace CalamityMod.NPCs.SunkenSea } } else - { NPC.damage = 0; - } } public override bool? CanBeHitByProjectile(Projectile projectile) diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 44072e4e64..d4ba2fc0ea 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - NPC.damage = 20; + NPC.damage = Main.hardMode ? 50 : 20; NPC.width = 116; NPC.height = 36; NPC.defense = Main.hardMode ? 15 : 5; @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; - NPC.knockBackResist = 0f; + NPC.knockBackResist = 0.5f; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -81,11 +85,7 @@ namespace CalamityMod.NPCs.SunkenSea if (NPC.justHit && !hasBeenHit) { hasBeenHit = true; - NPC.damage = Main.expertMode ? 40 : 20; - if (Main.hardMode) - { - NPC.damage = Main.expertMode ? 100 : 50; - } + NPC.damage = NPC.defDamage; NPC.noTileCollide = true; NPC.noGravity = true; if (NPC.Center.X < Main.player[NPC.target].Center.X) @@ -163,9 +163,7 @@ namespace CalamityMod.NPCs.SunkenSea } } else - { NPC.damage = 0; - } } public override void FindFrame(int frameHeight) diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 6b51c3001e..8919409656 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -45,6 +45,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 62b9125197..9fb9fba030 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().canBreakPlayerDefense = true; NPC.lavaImmune = true; NPC.npcSlots = 5f; - NPC.damage = 50; + NPC.damage = Main.hardMode ? 100 : 50; NPC.width = 160; NPC.height = 120; NPC.defense = 9999; @@ -72,6 +72,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -136,13 +140,8 @@ namespace CalamityMod.NPCs.SunkenSea if (!statChange) { - NPC.defense = 10; - NPC.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - NPC.defense = 35; - NPC.damage = Main.expertMode ? 200 : 100; - } + NPC.defense = Main.hardMode ? 35 : 10; + NPC.damage = NPC.defDamage; statChange = true; } @@ -227,11 +226,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.alpha -= Main.hardMode ? 7 : 4; if (NPC.alpha <= 0) { - NPC.damage = Main.expertMode ? 100 : 50; - if (Main.hardMode) - { - NPC.damage = Main.expertMode ? 200 : 100; - } + NPC.damage = NPC.defDamage; NPC.chaseable = true; NPC.dontTakeDamage = false; NPC.alpha = 0; diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 4bb9a0b7bc..beca68a2f3 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { NPC.noGravity = true; - NPC.damage = Main.hardMode ? 40 : 20; //normal damage + NPC.damage = Main.hardMode ? 40 : 20; NPC.width = 72; NPC.height = 58; NPC.defense = Main.hardMode ? 25 : 10; @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -75,40 +79,40 @@ namespace CalamityMod.NPCs.SunkenSea { if ((NPC.Center.Y + 10f) > Main.player[NPC.target].Center.Y) { - if (CalamityWorld.death) //gotta do damage scaling directly + if (CalamityWorld.death) { - NPC.damage = Main.hardMode ? 240 : 120; + NPC.damage = NPC.defDamage * 3; } else if (CalamityWorld.revenge) { - NPC.damage = Main.hardMode ? 168 : 84; + NPC.damage = (int)(NPC.defDamage * 2.75); } else if (Main.expertMode) { - NPC.damage = Main.hardMode ? 160 : 80; + NPC.damage = (int)(NPC.defDamage * 2.5); } else { - NPC.damage = Main.hardMode ? 80 : 40; + NPC.damage = (int)(NPC.defDamage * 1.25); } } else { - if (CalamityWorld.death) //gotta do damage scaling directly + if (CalamityWorld.death) { - NPC.damage = Main.hardMode ? 120 : 60; + NPC.damage = (int)(NPC.defDamage * 2.5); } else if (CalamityWorld.revenge) { - NPC.damage = Main.hardMode ? 84 : 42; + NPC.damage = (int)(NPC.defDamage * 2.25); } else if (Main.expertMode) { - NPC.damage = Main.hardMode ? 80 : 40; + NPC.damage = NPC.defDamage * 2; } else { - NPC.damage = Main.hardMode ? 40 : 20; + NPC.damage = NPC.defDamage; } } Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index a1d78afbb2..7a678cddb8 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -54,6 +54,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs index a3d8b2b751..4ae2ddd69b 100644 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -41,6 +41,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs index bd78df1ee7..be4f5fd86c 100644 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs index 497bb8bb52..fb223802b1 100644 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs index 00c348e97f..66271b0ee7 100644 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index c7d82c8f11..e6d54584b3 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.Center, ChainEndpoints[i] + NPC.DirectionTo(ChainEndpoints[i]) * 25f }; - PrimitiveSet.Prepare(points, new(PrimitiveWidthFunction, PrimitiveColorFunction), 40); + PrimitiveRenderer.RenderTrail(points, new(PrimitiveWidthFunction, PrimitiveColorFunction), 40); } return true; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 78de2cdc01..a49588e3a7 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1669,7 +1669,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region FirstStage if (NPC.ai[0] == 0f) { - NPC.damage = NPC.defDamage; if (wormAlive) { NPC.dontTakeDamage = true; @@ -1794,6 +1793,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 12f; float acceleration = 0.12f; @@ -1918,6 +1920,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (Main.getGoodWorld) @@ -1962,6 +1967,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[2] += 1f; if (Math.Abs(NPC.velocity.X) > 0.15f) @@ -1969,6 +1977,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 25f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!canDespawn) { NPC.velocity *= 0.96f; @@ -1984,6 +1995,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 70f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[3] += 1f; NPC.ai[2] = 0f; NPC.TargetClosest(); @@ -2005,6 +2019,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2016,7 +2033,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2087,6 +2104,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2098,7 +2118,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2169,9 +2189,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region Transition - else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.dontTakeDamage = true; NPC.chaseable = false; @@ -2226,7 +2248,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region LastStage else { - NPC.damage = NPC.defDamage; if (wormAlive) { NPC.dontTakeDamage = true; @@ -2345,6 +2366,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 12f; float acceleration = 0.12f; @@ -2467,6 +2491,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 1f) { + // Set damage + NPC.damage = NPC.defDamage; + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (Main.getGoodWorld) @@ -2487,9 +2514,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 2f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[2] += 1f; if (NPC.ai[2] >= 25f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (!canDespawn) { NPC.velocity *= 0.96f; @@ -2506,6 +2539,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[2] >= 70f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.ai[3] += 1f; NPC.ai[2] = 0f; NPC.TargetClosest(); @@ -2527,6 +2563,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2538,7 +2577,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -2610,6 +2649,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + // How fast SCal moves to the destination float velocity = 32f; float acceleration = 1.2f; @@ -2621,7 +2663,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } int posX = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + if (NPC.Center.X < player.position.X + player.width) posX = -1; // This is where SCal should be @@ -3331,10 +3373,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 100; - NPC.height = 100; + NPC.position = NPC.Center; + NPC.width = NPC.height = 100; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index 45dd64c478..66e6f36cc1 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Boss // It is not used anywhere else. Projectile.ai[0] = i; - PrimitiveSet.Prepare(positions, new(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:Flame"]), 55); + PrimitiveRenderer.RenderTrail(positions, new(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:Flame"]), 55); } return false; } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 02cd9981bf..630c71f09a 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -229,8 +229,8 @@ namespace CalamityMod.Projectiles.Boss if (orbToAttachTo != null) { List arcPoints = DetermineElectricArcPoints(Projectile.Center, orbToAttachTo.Center, 117); - PrimitiveSet.Prepare(arcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(arcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); } lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/ArtemisChargeTelegraph.cs b/Projectiles/Boss/ArtemisChargeTelegraph.cs index 63e62c0438..5370ee45f7 100644 --- a/Projectiles/Boss/ArtemisChargeTelegraph.cs +++ b/Projectiles/Boss/ArtemisChargeTelegraph.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.Center, Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * TelegraphWidth }; - PrimitiveSet.Prepare(drawPositions, new(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:Flame"]), 87); + PrimitiveRenderer.RenderTrail(drawPositions, new(TelegraphPrimitiveWidth, TelegraphPrimitiveColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:Flame"]), 87); return false; } } diff --git a/Projectiles/Boss/ArtemisSpinLaserbeam.cs b/Projectiles/Boss/ArtemisSpinLaserbeam.cs index c83141068b..c4394c07ff 100644 --- a/Projectiles/Boss/ArtemisSpinLaserbeam.cs +++ b/Projectiles/Boss/ArtemisSpinLaserbeam.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss GameShaders.Misc["CalamityMod:ArtemisLaser"].UseColor(Color.Cyan); GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage1("Images/Extra_189"); GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage2("Images/Misc/Perlin"); - PrimitiveSet.Prepare(baseDrawPoints, new(LaserWidthFunction, LaserColorFunction, shader: GameShaders.Misc["CalamityMod:ArtemisLaser"]), 64); + PrimitiveRenderer.RenderTrail(baseDrawPoints, new(LaserWidthFunction, LaserColorFunction, shader: GameShaders.Misc["CalamityMod:ArtemisLaser"]), 64); return false; } diff --git a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs index 399da5d9fb..7465dfea8a 100644 --- a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs +++ b/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + generalOffset, shader: GameShaders.Misc["CalamityMod:PrismaticStreak"]), 65); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + generalOffset, shader: GameShaders.Misc["CalamityMod:PrismaticStreak"]), 65); Main.spriteBatch.ExitShaderRegion(); return true; } diff --git a/Projectiles/Boss/DraedonSummonLaser.cs b/Projectiles/Boss/DraedonSummonLaser.cs index 5b8ad0cdf6..173b3f3adf 100644 --- a/Projectiles/Boss/DraedonSummonLaser.cs +++ b/Projectiles/Boss/DraedonSummonLaser.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss basePoints[i] = Projectile.Center - Vector2.UnitY * i / basePoints.Length * LaserLength; Vector2 overallOffset = Projectile.Size * 0.5f; - PrimitiveSet.Prepare(basePoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:Flame"]), 92); + PrimitiveRenderer.RenderTrail(basePoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:Flame"]), 92); return false; } diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs index eaa8d6dbed..9696f6a6a6 100644 --- a/Projectiles/Boss/DyingSun.cs +++ b/Projectiles/Boss/DyingSun.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss rotationPoints.Add(adjustedAngle); drawPoints.Add(Vector2.Lerp(Projectile.Center - offsetDirection * Radius / 2f, Projectile.Center + offsetDirection * Radius / 2f, i / 16f)); } - PrimitiveSet.Prepare(drawPoints, new(SunWidthFunction, SunColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 24); + PrimitiveRenderer.RenderTrail(drawPoints, new(SunWidthFunction, SunColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 24); } return false; } diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 10fb38c403..dfb8a4e429 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss drawPoints[i] = Vector2.Lerp(top, bottom, i / (float)(drawPoints.Length - 1)); drawPoints[drawPoints.Length - 1] = bottom; - PrimitiveSet.Prepare(drawPoints, new((_) => Projectile.width * 0.5f + 16f, ColorFunction, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 85); + PrimitiveRenderer.RenderTrail(drawPoints, new((_) => Projectile.width * 0.5f + 16f, ColorFunction, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 85); Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; for (int i = 0; i < 110; i++) diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 107e412e22..f299808576 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -324,7 +324,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float angularTurn = i * swingAngularDirection * -0.09f; drawPoints[i] = Projectile.position + perpendicularDirection.RotatedBy(angularTurn) * offsetFactor; } - PrimitiveSet.Prepare(drawPoints, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + bladeOffset, shader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]), 50); + PrimitiveRenderer.RenderTrail(drawPoints, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + bladeOffset, shader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]), 50); Main.EntitySpriteDraw(bladeTexture, Projectile.Center + bladeOffset - Main.screenPosition, frame, Color.White, Projectile.rotation + MathHelper.PiOver2, origin, Projectile.scale, SpriteEffects.None, 0); Main.EntitySpriteDraw(hiltTexture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation + MathHelper.PiOver2, hiltTexture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index 52955ecffb..eb085dd078 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); return false; } } diff --git a/Projectiles/Enemy/GammRayBurst.cs b/Projectiles/Enemy/GammRayBurst.cs index 14912610a2..bb36654293 100644 --- a/Projectiles/Enemy/GammRayBurst.cs +++ b/Projectiles/Enemy/GammRayBurst.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Enemy GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage1("Images/Extra_189"); GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage2("Images/Misc/Perlin"); - PrimitiveSet.Prepare(baseDrawPoints, new(LaserWidthFunction, LaserColorFunction, shader: GameShaders.Misc["CalamityMod:ArtemisLaser"]), 64); + PrimitiveRenderer.RenderTrail(baseDrawPoints, new(LaserWidthFunction, LaserColorFunction, shader: GameShaders.Misc["CalamityMod:ArtemisLaser"]), 64); return false; } diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 328f95e38e..a1587fb01b 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 85); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 85); return false; } } diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index 9f79ccc6c2..b3e400b48c 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Magic GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), 180); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), 180); Main.spriteBatch.ExitShaderRegion(); Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, 0, 0); diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index d9c6520850..b7d62c4130 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 84); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 84); return false; } } diff --git a/Projectiles/Magic/ExoVortex.cs b/Projectiles/Magic/ExoVortex.cs index 86500b03e3..fed7e9cdfc 100644 --- a/Projectiles/Magic/ExoVortex.cs +++ b/Projectiles/Magic/ExoVortex.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic // Draw the streak trail. GameShaders.Misc["CalamityMod:SideStreakTrail"].UseImage1("Images/Misc/Perlin"); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); diff --git a/Projectiles/Magic/ExoVortex2.cs b/Projectiles/Magic/ExoVortex2.cs index 2392c49eb8..d9351189ea 100644 --- a/Projectiles/Magic/ExoVortex2.cs +++ b/Projectiles/Magic/ExoVortex2.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Magic // Draw the streak trail. GameShaders.Misc["CalamityMod:SideStreakTrail"].UseImage1("Images/Misc/Perlin"); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveTrailColor, PrimitiveOffsetFunction, shader: GameShaders.Misc["CalamityMod:SideStreakTrail"]), 51); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 4d5ae16c3f..e31698e9c6 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 80); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 80); return false; } diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 04a02e2e4e..a58f5f7bfa 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); return false; } diff --git a/Projectiles/Magic/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs index 68aeb679cd..ed8152f370 100644 --- a/Projectiles/Magic/RainbowRocket.cs +++ b/Projectiles/Magic/RainbowRocket.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Projectile.oldPos[0] = Projectile.position + Projectile.velocity.SafeNormalize(Vector2.Zero) * 50f; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity), 80); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity), 80); Texture2D rocketTexture = ModContent.Request(Texture).Value; Main.EntitySpriteDraw(rocketTexture, diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index 0647fd9e8b..df0f3ecfc8 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < basePoints.Length; i++) basePoints[i] = Projectile.Center + Projectile.velocity * i / (basePoints.Length - 1f) * LaserLength; - PrimitiveSet.Prepare(basePoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 92); + PrimitiveRenderer.RenderTrail(basePoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: GameShaders.Misc["CalamityMod:Flame"]), 92); return false; } diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index 34c4185e47..19e3dc6b11 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using CalamityMod.Graphics.Primitives; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -130,9 +131,6 @@ namespace CalamityMod.Projectiles.Magic return true; } - public PrimitiveTrail LightningDrawer; - - public PrimitiveTrail LightningBackgroundDrawer; internal float WidthFunction(float completionRatio) { return MathHelper.Clamp(completionRatio * 15, 1, 1.5f); @@ -152,10 +150,6 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); - if (LightningDrawer is null) - LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:TeslaTrail"]); - if (LightningBackgroundDrawer is null) - LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:TeslaTrail"]); GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); // every 2 frames update the offsets are randomized. This is effectively control for the lightning's fps @@ -190,8 +184,9 @@ namespace CalamityMod.Projectiles.Magic finalPoints.Add(baseVec); } - LightningBackgroundDrawer.Draw(finalPoints, -Main.screenPosition, 75); - LightningDrawer.Draw(finalPoints, -Main.screenPosition, 75); + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty + PrimitiveRenderer.RenderTrail(finalPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 75); + PrimitiveRenderer.RenderTrail(finalPoints, new(WidthFunction, ColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 75); Main.spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index 4a2252092f..fcc64df360 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Magic { PrimColorMult = colorMod; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); Main.spriteBatch.End(); diff --git a/Projectiles/Melee/EonBolt.cs b/Projectiles/Melee/EonBolt.cs index 16957c1ace..d6aaba4fd7 100644 --- a/Projectiles/Melee/EonBolt.cs +++ b/Projectiles/Melee/EonBolt.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); Texture2D texture = Request("CalamityMod/Projectiles/Melee/GalaxiaBolt").Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 08c49e8108..bb0c4639f7 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -171,12 +171,12 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(Color.White); GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(Color.White); - PrimitiveSet.Prepare(Projectile.oldPos, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index f72f1a710d..f8de42349d 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -432,7 +432,7 @@ namespace CalamityMod.Projectiles.Melee public Color PierceColorFunction(float completionRatio) => Color.Lime * Projectile.Opacity; //The trail color doesnt matter here - public IEnumerable GenerateSlashPoints() + public List GenerateSlashPoints() { List result = new(); @@ -473,7 +473,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue(Direction == 1); GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); - PrimitiveSet.Prepare(GenerateSlashPoints(), new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 95); + PrimitiveRenderer.RenderTrail(GenerateSlashPoints(), new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 95); Main.spriteBatch.ExitShaderRegion(); } @@ -498,7 +498,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos.Take(51), new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 53); + PrimitiveRenderer.RenderTrail(Projectile.oldPos.Take(51).ToArray(), new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 53); Main.spriteBatch.ExitShaderRegion(); } diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index 483bc1e142..e3f371fa87 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, Color.DeepSkyBlue * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, 0.3f * Projectile.scale, SpriteEffects.None, 0); GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/DoubleTrail")); - PrimitiveSet.Prepare(new Vector2[] { Projectile.Center, Owner.MountedCenter - normalizedVelocity * 13f }, new(WidthFunction, ColorFunction, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(new Vector2[] { Projectile.Center, Owner.MountedCenter - normalizedVelocity * 13f }, new(WidthFunction, ColorFunction, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); 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/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index 4e7e0d672c..e729ec1e3f 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + generalOffset, shader: GameShaders.Misc["CalamityMod:PrismaticStreak"]), 65); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + generalOffset, shader: GameShaders.Misc["CalamityMod:PrismaticStreak"]), 65); Main.spriteBatch.ExitShaderRegion(); return true; } diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 01868f9745..6d609a9ec7 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = Request("CalamityMod/Projectiles/Melee/RendingNeedle").Value; GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, OffsetFunction, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, OffsetFunction, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/StygianShieldAttack.cs b/Projectiles/Melee/StygianShieldAttack.cs index ca7f2628c3..df65f2e949 100644 --- a/Projectiles/Melee/StygianShieldAttack.cs +++ b/Projectiles/Melee/StygianShieldAttack.cs @@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee // Main trail GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + extraOffset + Main.screenPosition - direction * 80f, + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + extraOffset + Main.screenPosition - direction * 80f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 10); ArrowEffect.Parameters["halfSpreadAngle"].SetValue(MathHelper.ToRadians(7.5f)); diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 224be6887f..4bc31dba95 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -262,7 +262,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.direction == -1) Utils.Swap(ref leftVertexPosition, ref rightVertexPosition); - PrimitiveSet.Prepare(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => BladeCenterPosition - Projectile.position, + PrimitiveRenderer.RenderTrail(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => BladeCenterPosition - Projectile.position, shader: GameShaders.Misc["CalamityMod:FadingSolidTrail"], initialVertexPositionsOverride: (leftVertexPosition, rightVertexPosition)), 67); } diff --git a/Projectiles/Melee/TerratomereBeam.cs b/Projectiles/Melee/TerratomereBeam.cs index 438a5eaac9..e25ce01dd4 100644 --- a/Projectiles/Melee/TerratomereBeam.cs +++ b/Projectiles/Melee/TerratomereBeam.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee points.Add(ControlPoints[i] + ControlPoints[i].SafeNormalize(Vector2.Zero) * (Projectile.scale - 1f) * 40f); for (int i = 0; i < 3; i++) - PrimitiveSet.Prepare(points, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 65); + PrimitiveRenderer.RenderTrail(points, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 65); Main.spriteBatch.ExitShaderRegion(); return false; diff --git a/Projectiles/Melee/TerratomereBigSlash.cs b/Projectiles/Melee/TerratomereBigSlash.cs index eb46b38302..084507e0cd 100644 --- a/Projectiles/Melee/TerratomereBigSlash.cs +++ b/Projectiles/Melee/TerratomereBigSlash.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(Terratomere.TerraColor2); for (int i = 0; i < 4; i++) - PrimitiveSet.Prepare(Projectile.oldPos, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); return false; } diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 8b10698548..e1748ece0a 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -237,7 +237,7 @@ namespace CalamityMod.Projectiles.Melee PrepareSlashShader(Direction == 1); if (SwingCompletionAtStartOfTrail > SwingCompletionRatio) - PrimitiveSet.Prepare(GenerateSlashPoints(), new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 95); + PrimitiveRenderer.RenderTrail(GenerateSlashPoints().ToArray(), new(SlashWidthFunction, SlashColorFunction, (_) => Projectile.Center, shader: GameShaders.Misc["CalamityMod:ExobladeSlash"]), 95); Main.spriteBatch.ExitShaderRegion(); } diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index c8a7fccde0..ab8ba1a1fb 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee positions.Add(position); } - PrimitiveSet.Prepare(positions, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]), 50); + PrimitiveRenderer.RenderTrail(positions, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]), 50); return true; } } diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index f0a57b1625..0c4f3dbeb2 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee drawPoints[i] -= (Projectile.oldRot[i] + MathHelper.PiOver4).ToRotationVector2() * Projectile.height * 0.5f; if (Time > Projectile.oldPos.Length) - PrimitiveSet.Prepare(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 88); + PrimitiveRenderer.RenderTrail(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 88); Vector2 drawPosition = Projectile.Center - Main.screenPosition; for (int i = 0; i < 6; i++) diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index eb527dbfcf..06a0ef6ab1 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1f, delegate (Vector2 offset, Color colorMod) { PrimColorMult = colorMod; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); //Draw the screw with chroma abberation diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index 274d145215..f7f4022061 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseColor(mainColor); GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].UseSecondaryColor(secondaryColor); GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"]), 53); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"]), 53); Texture2D tex = ModContent.Request(Texture).Value; Vector2 origin = tex.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs index 50bebe3253..9bf2ca9680 100644 --- a/Projectiles/Ranged/ExoLightningBolt.cs +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, false, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]), 18); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, false, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]), 18); return false; } diff --git a/Projectiles/Ranged/MarksmanShot.cs b/Projectiles/Ranged/MarksmanShot.cs index b4048dfc0c..5afea94f6a 100644 --- a/Projectiles/Ranged/MarksmanShot.cs +++ b/Projectiles/Ranged/MarksmanShot.cs @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Ranged return false; GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/BasicTrail")); - PrimitiveSet.Prepare(trailPositions, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), trailLength); + PrimitiveRenderer.RenderTrail(trailPositions, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), trailLength); return false; } diff --git a/Projectiles/Ranged/MeowCreature.cs b/Projectiles/Ranged/MeowCreature.cs index 9b2427d1b6..e7a3eb97c4 100644 --- a/Projectiles/Ranged/MeowCreature.cs +++ b/Projectiles/Ranged/MeowCreature.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged // The creature glows public override void PostDraw(Color lightColor) { - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 30); Texture2D glow = ModContent.Request(Texture).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/MineralMortarProjectile.cs b/Projectiles/Ranged/MineralMortarProjectile.cs index b21bc0299c..6d9d685dfd 100644 --- a/Projectiles/Ranged/MineralMortarProjectile.cs +++ b/Projectiles/Ranged/MineralMortarProjectile.cs @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 origin = texture.Size() * 0.5f; GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); - PrimitiveSet.Prepare(Projectile.oldPos, new(TrailWidthFunction, ColorTrailFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 50); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, ColorTrailFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 50); if (CalamityConfig.Instance.Afterimages) { for (int i = 0; i < 3; i++) diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index dfacd5f717..00bf2f3f8a 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 sinOffset = (Vector2.UnitY * direction * MathF.Sin(i * MathHelper.Pi * 0.125f) * 24f).RotatedBy(Projectile.oldRot[i]); trailPositions.Add(Projectile.oldPos[i] + sinOffset); } - PrimitiveSet.Prepare(trailPositions, new(HelixTrailWidthFunction, HelixTrailColorFunction, (_) => Projectile.Size * 0.5f), 60); + PrimitiveRenderer.RenderTrail(trailPositions, new(HelixTrailWidthFunction, HelixTrailColorFunction, (_) => Projectile.Size * 0.5f), 60); } return false; } diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index a1089ae000..0895bf64ac 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -216,9 +217,9 @@ namespace CalamityMod.Projectiles.Ranged float drawRotation = Projectile.rotation + MathHelper.PiOver2; Vector2 rotationPoint = frame.Size() * 0.5f; - PrimitiveTrail trail = new PrimitiveTrail(TrailWidthFunction, TrailColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 25); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index dd91f3dc53..55c5a63b0e 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -167,9 +168,9 @@ namespace CalamityMod.Projectiles.Ranged if (Time >= TimeToLaunch) { - PrimitiveTrail trail = new PrimitiveTrail(TrailWidthFunction, TrailColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - trail.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 25); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); } Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/SpeedBlasterShot.cs b/Projectiles/Ranged/SpeedBlasterShot.cs index 1cb35c3b0c..5a5d5f816b 100644 --- a/Projectiles/Ranged/SpeedBlasterShot.cs +++ b/Projectiles/Ranged/SpeedBlasterShot.cs @@ -180,7 +180,7 @@ namespace CalamityMod.Projectiles.Ranged internal Color ColorFunction(float completionRatio) => GetColor(Projectile.ai[0]) * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 20); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f), 20); return true; } } diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 7d00090138..9ce04b3a20 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); return false; } diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index dc828efa75..7eed59d9ce 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 60); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 60); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } diff --git a/Projectiles/Ranged/WulfrumScrapBullet.cs b/Projectiles/Ranged/WulfrumScrapBullet.cs index fd26a60f77..09cfa52d89 100644 --- a/Projectiles/Ranged/WulfrumScrapBullet.cs +++ b/Projectiles/Ranged/WulfrumScrapBullet.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/BasicTrail")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); return false; } } diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index e0b1f441a0..1e79b95400 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(ref Color lightColor) { - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false), 90); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false), 90); return false; } } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index ae8746334d..33b3450ea2 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Rogue else { GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 86f, false, + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 86f, false, shader: GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"]), 60); Texture2D spearTexture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Rogue/StormfrontLightning.cs b/Projectiles/Rogue/StormfrontLightning.cs index 5d2a2c36ed..4325f21435 100644 --- a/Projectiles/Rogue/StormfrontLightning.cs +++ b/Projectiles/Rogue/StormfrontLightning.cs @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Rogue GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); - PrimitiveSet.Prepare(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.3f, false, + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.3f, false, shader: GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]), 10); return false; } diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index 16dbf23652..e09e7e14ab 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1f, delegate (Vector2 offset, Color colorMod) { PrimColorMult = colorMod; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); diff --git a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs index 47530f606a..0935a00b48 100644 --- a/Projectiles/Summon/CnidarianJellyfishOnTheString.cs +++ b/Projectiles/Summon/CnidarianJellyfishOnTheString.cs @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2[] segmentPositions = Segments.Select(x => x.position).ToArray(); - PrimitiveSet.Prepare(segmentPositions, new(PrimWidthFunction, PrimColorFunction), 66); + PrimitiveRenderer.RenderTrail(segmentPositions, new(PrimWidthFunction, PrimColorFunction), 66); Texture2D tex = Request(Texture).Value; diff --git a/Projectiles/Summon/CosmilampBeam.cs b/Projectiles/Summon/CosmilampBeam.cs index c013827096..8bc3f2f2bb 100644 --- a/Projectiles/Summon/CosmilampBeam.cs +++ b/Projectiles/Summon/CosmilampBeam.cs @@ -107,11 +107,12 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] = 0f; GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - var primSet = PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 42); + var settings = new PrimitiveSettings(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, settings, 42); Projectile.localAI[0] = 1f; - if (primSet.HasValue) - primSet.Value.Render(); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, settings, 42); + return false; } } diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs index e198f289a5..4d6959f07d 100644 --- a/Projectiles/Summon/DaedalusLightning.cs +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false), 90); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, false), 90); return false; } #endregion diff --git a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs index 9ebc57cc6b..bbcee7b814 100644 --- a/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs +++ b/Projectiles/Summon/SmallAresArms/MinionTeslaOrb.cs @@ -114,8 +114,8 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms if (orbToAttachTo != null) { List arcPoints = AresTeslaOrb.DetermineElectricArcPoints(Projectile.Center, orbToAttachTo.Center, 117); - PrimitiveSet.Prepare(arcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); - PrimitiveSet.Prepare(arcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arcPoints, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false), 90); + PrimitiveRenderer.RenderTrail(arcPoints, new(WidthFunction, ColorFunction, smoothen: false), 90); } lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index 8bdb9532f5..74fa359aa1 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -471,7 +471,7 @@ namespace CalamityMod.Projectiles.Summon CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1.8f, delegate (Vector2 offset, Color colorMod) { PrimColorMult = colorMod; - PrimitiveSet.Prepare(drawPos, new(WidthFunction, ColorFunction, (_) => offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(drawPos, new(WidthFunction, ColorFunction, (_) => offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); Main.spriteBatch.End(); diff --git a/Projectiles/Summon/WulfrumEnergyBurst.cs b/Projectiles/Summon/WulfrumEnergyBurst.cs index 5b2779a14f..528cbf32ba 100644 --- a/Projectiles/Summon/WulfrumEnergyBurst.cs +++ b/Projectiles/Summon/WulfrumEnergyBurst.cs @@ -185,7 +185,7 @@ namespace CalamityMod.Projectiles.Summon CalamityUtils.DrawChromaticAberration(Vector2.UnitX, 1.5f, delegate (Vector2 offset, Color colorMod) { PrimColorMult = colorMod; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); Main.spriteBatch.End(); diff --git a/Projectiles/Summon/WulfrumFusionBolt.cs b/Projectiles/Summon/WulfrumFusionBolt.cs index 6da9fc7847..a32b4ef95a 100644 --- a/Projectiles/Summon/WulfrumFusionBolt.cs +++ b/Projectiles/Summon/WulfrumFusionBolt.cs @@ -192,7 +192,7 @@ namespace CalamityMod.Projectiles.Summon { PrimColorMult = colorMod; - PrimitiveSet.Prepare(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f + offset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30); }); Main.spriteBatch.End(); diff --git a/Projectiles/Typeless/GemTechArmorGem.cs b/Projectiles/Typeless/GemTechArmorGem.cs index b336eaccd0..5b09a71ae4 100644 --- a/Projectiles/Typeless/GemTechArmorGem.cs +++ b/Projectiles/Typeless/GemTechArmorGem.cs @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Typeless Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(Color.White), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); if (Projectile.ai[0] > UpwardFlyTime + RedirectTime) - PrimitiveSet.Prepare(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 71); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 71); return false; } diff --git a/Projectiles/Typeless/MythrilFlare.cs b/Projectiles/Typeless/MythrilFlare.cs index 0978506c57..56ebc10890 100644 --- a/Projectiles/Typeless/MythrilFlare.cs +++ b/Projectiles/Typeless/MythrilFlare.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Typeless { // Prepare the flame trail shader with its map texture. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); - PrimitiveSet.Prepare(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 74); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 74); return false; } diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs index 3981836bce..fb665cd92b 100644 --- a/Projectiles/Typeless/SuicideBomberDemon.cs +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -264,7 +264,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 trailOffset = Projectile.Size * 0.5f; trailOffset += (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 20f; - PrimitiveSet.Prepare(Projectile.oldPos, new(FlameTrailWidthFunction, FlameTrailColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 61); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FlameTrailWidthFunction, FlameTrailColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 61); } Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 9096654a32..e737424bf2 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Typeless if (State == HookState.Grappling) segmentPositions = Owner.GetModPlayer().Segments.Select(x => x.position).ToArray(); - PrimitiveSet.Prepare(new List(segmentPositions) { Owner.Center }, new(PrimWidthFunction, PrimColorFunction), 30); + PrimitiveRenderer.RenderTrail(new List(segmentPositions) { Owner.Center }, new(PrimWidthFunction, PrimColorFunction, smoothen: State is HookState.Grappling), 30); Texture2D texture = TextureAssets.Projectile[Type].Value;