Merge branch '1.4.4' into MegalodonLine

This commit is contained in:
mochi-angel committed 2024-12-02 05:41:35 -08:00
commit 2f9c8d83b8
7 files changed
+60 -24

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
<Import Project="..\tModLoader.targets" />
<PropertyGroup>
<AssemblyName>CalamityMod</AssemblyName>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
+46 -7
View File
@@ -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<ArkoftheCosmosSwungBlade>());
}
// 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<ArkoftheCosmosParryHoldout>()))
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<ArkoftheCosmosParryHoldout>(), 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<ArkoftheCosmosBlast>(), (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<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>() || n.type == ProjectileType<ArkoftheCosmosParryHoldout>())))
Projectile.NewProjectile(source, player.Center, velocity, ProjectileType<ArkoftheCosmosParryHoldout>(), 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<ArkoftheAncientsParryHoldout>() ||
n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() ||
n.type == ProjectileType<ArkoftheElementsParryHoldout>() ||
n.type == ProjectileType<ArkoftheCosmosParryHoldout>()));
if (!anyArkParryExists)
Projectile.NewProjectile(source, player.Center, velocity, ProjectileType<ArkoftheCosmosParryHoldout>(), 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;
}
@@ -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 <right> while on parry cooldown with empowered charges will provoke a Big Rip in spacetime and use all charges
BlastInfo: Double <right> with charges available to cause a Big Rip in spacetime and consume all charges
}
ArkoftheElements: {
@@ -1380,8 +1380,8 @@ TrueArkoftheAncients: {
'''
<right> 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
'''
}
+2 -2
View File
@@ -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;
}
}
+2 -2
View File
@@ -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;
}
}
@@ -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;
@@ -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;
}
}