Merge branch 'master' of https://github.com/CalamityTeam/CalamityMod
This commit is contained in:
commit
7d4a36d2ee
4 files changed
+95
-72
No files matched your search
+24
-14
@@ -133,6 +133,24 @@ namespace CalamityMod.CalPlayer
|
||||
public float SmoothenedMinecartRotation;
|
||||
#endregion
|
||||
|
||||
#region IL Editing Constants
|
||||
// These values are referenced by IL edits but don't fit into any other category.
|
||||
public const float BalloonJumpSpeedBoost = 0.75f;
|
||||
|
||||
// Shield slam stats
|
||||
public const int ShieldOfCthulhuIFrames = 6;
|
||||
public const int ShieldOfCthulhuBonkNoCollideFrames = 6;
|
||||
public const int SolarFlareIFrames = 12;
|
||||
public const float SolarFlareBaseDamage = 400f;
|
||||
|
||||
// Dodge stats
|
||||
public const int BeltDodgeCooldown = 5400;
|
||||
public const int MirrorDodgeCooldown = 5400;
|
||||
public const int DaedalusReflectCooldown = 5400;
|
||||
public const int ArcanumReflectCooldown = 5400;
|
||||
public const int EvolutionReflectCooldown = 7200;
|
||||
#endregion
|
||||
|
||||
#region Speedrun Timer
|
||||
// The Calamity Speedrun Timer uses the highest precision timing available to .NET and thus to the system hardware.
|
||||
// Current session time is maintained by CalamityMod.SpeedrunTimer, which is a C# Stopwatch running constantly while a player is loaded.
|
||||
@@ -254,18 +272,7 @@ namespace CalamityMod.CalPlayer
|
||||
public int spiritOriginBullseyeShootCountdown = 0;
|
||||
public int spiritOriginConvertedCrit = 0;
|
||||
|
||||
// Shield slam stats
|
||||
public const int ShieldOfCthulhuIFrames = 6;
|
||||
public const int ShieldOfCthulhuBonkNoCollideFrames = 6;
|
||||
public const int SolarFlareIFrames = 12;
|
||||
public const float SolarFlareBaseDamage = 400f;
|
||||
|
||||
// Dodge stats
|
||||
public const int BeltDodgeCooldown = 5400;
|
||||
public const int MirrorDodgeCooldown = 5400;
|
||||
public const int DaedalusReflectCooldown = 5400;
|
||||
public const int ArcanumReflectCooldown = 5400;
|
||||
public const int EvolutionReflectCooldown = 7200;
|
||||
private const int DashDisableCooldown = 12;
|
||||
public int dodgeCooldownTimer = 0;
|
||||
public bool disableAllDodges = false;
|
||||
|
||||
@@ -7093,8 +7100,6 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
player.wingTimeMax = 0;
|
||||
}
|
||||
|
||||
private const int DashDisableCooldown = 12;
|
||||
private void DisableDashes()
|
||||
{
|
||||
// Set the player to have no registered dashes.
|
||||
@@ -10646,6 +10651,11 @@ namespace CalamityMod.CalPlayer
|
||||
defenseDamageTaken = defenseDamageFloor;
|
||||
}
|
||||
|
||||
// There is also a cap on defense damage: 25% of the player's original defense.
|
||||
int cap = player.statDefense / 4;
|
||||
if (defenseDamageTaken > cap)
|
||||
defenseDamageTaken = cap;
|
||||
|
||||
// Apply that defense damage on top of whatever defense damage the player currently has.
|
||||
int previousDefenseDamage = CurrentDefenseDamage;
|
||||
totalDefenseDamage = previousDefenseDamage + defenseDamageTaken;
|
||||
|
||||
+56
-43
@@ -152,10 +152,10 @@ namespace CalamityMod.ILEditing
|
||||
IL.Terraria.Projectile.Damage += RemoveAerialBaneDamageBoost;
|
||||
IL.Terraria.Projectile.AI_001 += AdjustChlorophyteBullets;
|
||||
|
||||
// Movement speed balance
|
||||
IL.Terraria.Player.UpdateJumpHeight += BalloonAdjustment;
|
||||
IL.Terraria.Player.Update += JumpSpeedAdjustment;
|
||||
IL.Terraria.Player.Update += MaxRunSpeedAdjustment;
|
||||
// Movement speed balance
|
||||
IL.Terraria.Player.UpdateJumpHeight += FixJumpHeightBoosts;
|
||||
IL.Terraria.Player.Update += JumpSpeedAdjustment;
|
||||
IL.Terraria.Player.Update += MaxRunSpeedAdjustment;
|
||||
IL.Terraria.Player.Update += RunSpeedAdjustments;
|
||||
IL.Terraria.Player.Update += ReduceWingHoverVelocities;
|
||||
|
||||
@@ -224,10 +224,10 @@ namespace CalamityMod.ILEditing
|
||||
IL.Terraria.Projectile.Damage -= RemoveAerialBaneDamageBoost;
|
||||
IL.Terraria.Projectile.AI_001 -= AdjustChlorophyteBullets;
|
||||
|
||||
// Movement speed balance
|
||||
IL.Terraria.Player.UpdateJumpHeight -= BalloonAdjustment;
|
||||
IL.Terraria.Player.Update -= JumpSpeedAdjustment;
|
||||
IL.Terraria.Player.Update -= MaxRunSpeedAdjustment;
|
||||
// Movement speed balance
|
||||
IL.Terraria.Player.UpdateJumpHeight -= FixJumpHeightBoosts;
|
||||
IL.Terraria.Player.Update -= JumpSpeedAdjustment;
|
||||
IL.Terraria.Player.Update -= MaxRunSpeedAdjustment;
|
||||
IL.Terraria.Player.Update -= RunSpeedAdjustments;
|
||||
IL.Terraria.Player.Update -= ReduceWingHoverVelocities;
|
||||
|
||||
@@ -947,45 +947,58 @@ namespace CalamityMod.ILEditing
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%.
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Movement speed balance
|
||||
private static void BalloonAdjustment(ILContext il)
|
||||
{
|
||||
// Remove the jump height boosts of balloons to make balancing them easier.
|
||||
var cursor = new ILCursor(il);
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20))) // The jump height variable is set to this specific value by the balloons.
|
||||
{
|
||||
LogFailure("Balloon Jump Height Removal", "Could not locate the balloon jump height buff variable.");
|
||||
return;
|
||||
}
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_I4, 15); // Reduce to base jump height.
|
||||
#region Movement speed balance
|
||||
private static void FixJumpHeightBoosts(ILContext il)
|
||||
{
|
||||
// Remove the code that makes Shiny Red Balloon SET jump height to a specific value to make balancing jump speed easier.
|
||||
var cursor = new ILCursor(il);
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20)))
|
||||
{
|
||||
LogFailure("Jump Height Boost Fixes", "Could not locate Shiny Red Balloon jump height assignment value.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Decrease the jump speed given by balloons.
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(6.51f))) // The jumpSpeed variable is set to this specific value by the balloons.
|
||||
{
|
||||
LogFailure("Balloon Jump Speed Nerf", "Could not locate the balloon jump speed buff variable.");
|
||||
return;
|
||||
}
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 6.26f); // Reduce by 5%.
|
||||
}
|
||||
// Delete both the ldc.i4 20 AND the store that assigns it to Player.jumpHeight.
|
||||
cursor.RemoveRange(2);
|
||||
|
||||
private static void JumpSpeedAdjustment(ILContext il)
|
||||
{
|
||||
// Increase the base jump speed of the player to make early game less of a slog.
|
||||
var cursor = new ILCursor(il);
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(5.01f))) // The jumpSpeed variable is set to this specific value before anything else occurs.
|
||||
{
|
||||
LogFailure("Base Jump Speed Buff", "Could not locate the jump speed variable.");
|
||||
return;
|
||||
}
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 5.51f); // Increase by 10%.
|
||||
}
|
||||
// Change the jump speed from Shiny Red Balloon to be an actual boost instead of a hardcoded replacement.
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcR4(6.51f)))
|
||||
{
|
||||
LogFailure("Jump Height Boost Fixes", "Could not locate Shiny Red Balloon jump speed assignment value.");
|
||||
return;
|
||||
}
|
||||
|
||||
private static void MaxRunSpeedAdjustment(ILContext il)
|
||||
// Replace the hardcoded 6.51 with a balanceable value in CalamityPlayer.
|
||||
cursor.Prev.Operand = CalamityPlayer.BalloonJumpSpeedBoost;
|
||||
// Load the player's current jumpSpeed onto the stack and add the boost to it.
|
||||
cursor.Emit(OpCodes.Ldsfld, typeof(Player).GetField("jumpSpeed"));
|
||||
cursor.Emit(OpCodes.Add);
|
||||
|
||||
// Remove the jump height addition from the Werewolf buff (Moon Charm).
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(2)))
|
||||
{
|
||||
LogFailure("Jump Height Boost Fixes", "Could not locate Moon Charm jump height boost value.");
|
||||
return;
|
||||
}
|
||||
cursor.Next.Operand = 0;
|
||||
}
|
||||
|
||||
private static void JumpSpeedAdjustment(ILContext il)
|
||||
{
|
||||
// Increase the base jump speed of the player to make early game less of a slog.
|
||||
var cursor = new ILCursor(il);
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(5.01f))) // The jumpSpeed variable is set to this specific value before anything else occurs.
|
||||
{
|
||||
LogFailure("Base Jump Speed Buff", "Could not locate the jump speed variable.");
|
||||
return;
|
||||
}
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 5.51f); // Increase by 10%.
|
||||
}
|
||||
|
||||
private static void MaxRunSpeedAdjustment(ILContext il)
|
||||
{
|
||||
// Increase the base max run speed of the player to make early game less of a slog.
|
||||
var cursor = new ILCursor(il);
|
||||
|
||||
@@ -92,13 +92,13 @@ namespace CalamityMod.Particles
|
||||
/// </summary>
|
||||
internal static void PrepareFusableParticleTargets()
|
||||
{
|
||||
// Don't attempt to prepare anything serverside or if the particle sets are unloaded.
|
||||
if (Main.netMode == NetmodeID.Server || ParticleSets is null)
|
||||
// Don't attempt to prepare anything serverside, if the particle sets are unloaded, or if on the menu.
|
||||
if (Main.netMode == NetmodeID.Server || ParticleSets is null || Main.gameMenu)
|
||||
return;
|
||||
|
||||
// Prepare the render target for all fusable particles.
|
||||
foreach (FusableParticleRenderCollection particleSet in ParticleSets)
|
||||
particleSet.ParticleSet.PrepareRenderTargetForDrawing();
|
||||
for (int i = 0; i < ParticleSets.Count; i++)
|
||||
ParticleSets[i].ParticleSet.PrepareRenderTargetForDrawing();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -106,13 +106,13 @@ namespace CalamityMod.Particles
|
||||
/// </summary>
|
||||
internal static void RenderAllFusableParticles(FusableParticleRenderLayer renderLayer)
|
||||
{
|
||||
// Don't attempt to render anything serverside.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
// Don't attempt to render anything serverside or on the menu.
|
||||
if (Main.netMode == NetmodeID.Server || Main.gameMenu)
|
||||
return;
|
||||
|
||||
foreach (FusableParticleRenderCollection particleRenderSet in ParticleSets)
|
||||
for (int i = 0; i < ParticleSets.Count; i++)
|
||||
{
|
||||
BaseFusableParticleSet particleSet = particleRenderSet.ParticleSet;
|
||||
BaseFusableParticleSet particleSet = ParticleSets[i].ParticleSet;
|
||||
|
||||
// Don't bother rendering if the set has no particles to render at the moment, for the sake of optimization.
|
||||
if (particleSet.Particles.Count <= 0)
|
||||
@@ -132,10 +132,10 @@ namespace CalamityMod.Particles
|
||||
// Restart the sprite batch. This must be done with an immediate sort mode since a shader is going to be applied.
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
for (int i = 0; i < particleSet.LayerCount; i++)
|
||||
for (int j = 0; j < particleSet.LayerCount; j++)
|
||||
{
|
||||
Effect shader = particleSet.BackgroundShaders[i];
|
||||
Texture2D backgroundTexture = particleSet.BackgroundTextures[i];
|
||||
Effect shader = particleSet.BackgroundShaders[j];
|
||||
Texture2D backgroundTexture = particleSet.BackgroundTextures[j];
|
||||
|
||||
// Draw the current target with the specified shader.
|
||||
shader.Parameters["edgeBorderSize"].SetValue(particleSet.BorderSize);
|
||||
@@ -144,7 +144,7 @@ namespace CalamityMod.Particles
|
||||
shader.Parameters["screenArea"].SetValue(new Vector2(Main.screenWidth, Main.screenHeight) / Main.GameViewMatrix.Zoom);
|
||||
shader.Parameters["screenMoveOffset"].SetValue(Main.screenPosition - Main.screenLastPosition);
|
||||
shader.Parameters["uWorldPosition"].SetValue(Main.screenPosition);
|
||||
shader.Parameters["renderTargetArea"].SetValue(new Vector2(backgroundTargets[i].Width, backgroundTargets[i].Height));
|
||||
shader.Parameters["renderTargetArea"].SetValue(new Vector2(backgroundTargets[j].Width, backgroundTargets[j].Height));
|
||||
shader.Parameters["invertedScreen"].SetValue(Main.LocalPlayer.gravDir == -1f);
|
||||
shader.Parameters["upscaleFactor"].SetValue(Vector2.One);
|
||||
shader.Parameters["generalBackgroundOffset"].SetValue(Vector2.Zero);
|
||||
@@ -154,13 +154,13 @@ namespace CalamityMod.Particles
|
||||
shader.Parameters["uImageSize1"].SetValue(backgroundTexture.Size());
|
||||
|
||||
// Do any optional shader operations prior to applying the shader.
|
||||
particleSet.PrepareOptionalShaderData(shader, i);
|
||||
particleSet.PrepareOptionalShaderData(shader, j);
|
||||
|
||||
// Apply the shader. This is what is used to connect separated blobs together.
|
||||
shader.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
// And draw the particle set's render target with said shader.
|
||||
Main.spriteBatch.Draw(backgroundTargets[i], Vector2.Zero, Color.White);
|
||||
Main.spriteBatch.Draw(backgroundTargets[j], Vector2.Zero, Color.White);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SupremeCataclysmFistAlt");
|
||||
|
||||
Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY;
|
||||
drawPosition -= projectile.velocity * 3.3f;
|
||||
drawPosition.X -= Math.Sign(projectile.velocity.X) * 40f;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame);
|
||||
spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f);
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user