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
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 b34f3fdb60..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: {
@@ -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/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;
}
}
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;
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;
}
}