From faa2be6c1496f1c50e0c40d73ac2a81686728f30 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 1 Dec 2024 22:21:16 -0500 Subject: [PATCH 1/4] Ark of the Ancients gets parry charges from projectiles --- .../Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 +- .../Melee/TrueArkOfTheAncients_ParryHoldout.cs | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index b34f3fdb60..767a2e845e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1380,8 +1380,8 @@ TrueArkoftheAncients: { ''' to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you brief invulnerability - Parrying an enemy empowers the next 10 swings of the sword, letting them throw stronger projectiles You can also parry projectiles to make them deal 80 less damage for a short period + Parrying will empower the next 10 swings of the sword, letting it throw stronger projectiles ''' } diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 1fbbab3c42..69a14c4809 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -47,18 +47,16 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } - public void GeneralParryEffects(bool npcHit) + public void GeneralParryEffects() { TrueArkoftheAncients sword = (Owner.HeldItem.ModItem as TrueArkoftheAncients); - if (sword != null && npcHit) + if (sword != null) sword.Charge = 10f; SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - if (npcHit) - SoundEngine.PlaySound(SoundID.Item67); + SoundEngine.PlaySound(SoundID.Item67); - Color parryTextColor = npcHit ? new Color(111, 247, 200) : new Color(98, 161, 139); - CombatText.NewText(Projectile.Hitbox, parryTextColor, CalamityUtils.GetTextValue("Misc.ArkParry"), true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); AlreadyParried = 1f; } @@ -67,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried > 0) return; - GeneralParryEffects(true); + GeneralParryEffects(); // 17APR2024: Ozzatron: True Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. @@ -127,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee proj.Size.Length() < 300 && //Only parry projectiles that aren't too large Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { - GeneralParryEffects(false); + GeneralParryEffects(); //Reduce the projectile's damage by 80 for a second. if (proj.Calamity().flatDR < 80) @@ -139,7 +137,6 @@ namespace CalamityMod.Projectiles.Melee if (Owner.velocity.Y != 0) Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; - break; } } From 982f178402d8c2178b6e317a7f15bc602f144282 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 1 Dec 2024 22:46:13 -0500 Subject: [PATCH 2/4] fix csproj calling for .NET 6 instead of .NET 8, stopping compilation --- CalamityMod.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalamityMod.csproj b/CalamityMod.csproj index 117d393f69..5aadf21dce 100644 --- a/CalamityMod.csproj +++ b/CalamityMod.csproj @@ -3,7 +3,7 @@ CalamityMod - net6.0 + net8.0 AnyCPU latest From b78332e6567e9795f2a9d8960c5d0ab9e193869f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 1 Dec 2024 23:30:42 -0500 Subject: [PATCH 3/4] Ark super attack is now double right click --- Items/Weapons/Melee/ArkoftheCosmos.cs | 53 ++++++++++++++++--- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 +- .../Melee/ArkOfTheCosmos_ParryHoldout.cs | 2 +- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 7802877825..047789a95c 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -22,6 +22,11 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; + // Frame window for double right click to snip. + // The right click item activation takes 3 frames, so the frame window is frame 3 to frame 11. + public static int DoubleRightClickFrames = 11; + private int rmbFrames = 0; + public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap @@ -97,36 +102,70 @@ namespace CalamityMod.Items.Weapons.Melee { player.Calamity().mouseWorldListener = true; + if (rmbFrames > 0) + --rmbFrames; + if (CanUseItem(player) && Combo != 4) Item.channel = false; if (Combo == 4) Item.channel = true; } + public override bool CanUseItem(Player player) { return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType()); } + // Right clicks for parries execute extremely fast (3 or less frames) and intentionally so. + public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) { - bool onParryCooldown = false; - if (Main.projectile.Any(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType())) - onParryCooldown = true; + // If it has been less than N frames since the last alt function use, this is a double right click. + bool rightMouseDoubleClick = rmbFrames > 0; - if (Charge > 0 && onParryCooldown) + // Check if a parry holdout is already present. + Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); + + bool canExecuteBlast = rightMouseDoubleClick && Charge > 0; + bool canExecuteParry = parrier is null && !canExecuteBlast; + + // The blast is checked first, so that it overrides the first right click triggering a parry. Blasts delete any active parry holdouts on use. + if (canExecuteBlast) { + // Fire the super blast, then set charge back to zero. float angle = velocity.ToRotation(); Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge); - Charge = 0; + + // If the parry holdout has existed for very few frames and hasn't parried something, just delete it. + if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames && parrier.ai[1] <= 0f) + { + parrier.active = false; + parrier.netUpdate = true; + } } - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) - Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); + // If the blast cannot be executed, then the parry is executed, assuming no existing holdout is present. + else if (canExecuteParry) + { + // Checks for parries from any Ark weapon, presumably to prevent some kind of abuse. + bool anyArkParryExists = Main.projectile.Any(n => + n.active && n.owner == player.whoAmI && ( + n.type == ProjectileType() || + n.type == ProjectileType() || + n.type == ProjectileType() || + n.type == ProjectileType())); + if (!anyArkParryExists) + Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); + } + + // Regardless of what transpires from the right click, set the double right click frames appropriately. + rmbFrames = DoubleRightClickFrames; return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 767a2e845e..3825c9a7ae 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -91,7 +91,7 @@ ArkoftheCosmos: { You can parry projectiles to make them deal 160 less damage for a short period Parrying will empower the next 15 swings of the sword ''' - BlastInfo: Pressing while on parry cooldown with empowered charges will provoke a Big Rip in spacetime and use all charges + BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges } ArkoftheElements: { diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 02feb57807..dbd19ed06d 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; private bool initialized = false; - const float MaxTime = 340; + internal const float MaxTime = 340; static float ParryTime = 15; public Vector2 DistanceFromPlayer => Projectile.velocity * 10 + Projectile.velocity * 10 * ThrustDisplaceRatio(); public float Timer => MaxTime - Projectile.timeLeft; From c6127b5b778cce9438a9913d23ff1984919b778a Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sun, 1 Dec 2024 23:57:47 -0500 Subject: [PATCH 4/4] fix calamity main menus crustifying all text & icons from vanilla and TML --- MainMenu/CalamityClassicMainMenu.cs | 4 ++-- MainMenu/CalamityModernMainMenu.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MainMenu/CalamityClassicMainMenu.cs b/MainMenu/CalamityClassicMainMenu.cs index 3ef9dbee99..35ca2e401d 100644 --- a/MainMenu/CalamityClassicMainMenu.cs +++ b/MainMenu/CalamityClassicMainMenu.cs @@ -152,10 +152,10 @@ namespace CalamityMod.MainMenu // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); return false; } } diff --git a/MainMenu/CalamityModernMainMenu.cs b/MainMenu/CalamityModernMainMenu.cs index ae9d77aac1..285c859a21 100644 --- a/MainMenu/CalamityModernMainMenu.cs +++ b/MainMenu/CalamityModernMainMenu.cs @@ -151,10 +151,10 @@ namespace CalamityMod.MainMenu // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); return false; } }