More Elemental Saw changes:

* Saws now slightly home towards the cursor while empowered
* Added a burst of homing bolts when the saw starts returning
* Continuous bolts when returning now only spawn while empowered
* Saw now deals 33% damage while returning after exhausting its pierce, instead of not dealing damage at all
This commit is contained in:
CongratsIsTrash committed 2024-04-25 22:11:21 -04:00
1 parent f359f14c21
commit db5150ff88
4 files changed
+64 -27

No files matched your search

@@ -448,10 +448,10 @@ ElementalSaw: {
Hold <left> to charge up a powerful elemental buzzsaw that deals close-range damage
Fired buzzsaws lacerate foes and inflict Elemental Mix, and can bounce off tiles
The longer it is charged, the more damage and pierce the buzzsaw has
Buzzsaws return to the player after exhausting their pierce, releasing homing bolts
Buzzsaws return to the player after exhausting their pierce
Press <right> to propel a short distance and fire a lingering buzzsaw towards the cursor
This dash has a {0} second cooldown
While on cooldown, buzzsaws slightly home to the cursor and release homing bolts faster while returning
While on cooldown, buzzsaws slightly home towards the cursor and release homing bolts while returning
Does not consume ammo
'''
}
+2
View File
@@ -37,6 +37,8 @@ namespace CalamityMod.Projectiles.Ranged
CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 13f, 20f);
}
public override bool? CanDamage() => Projectile.ai[0] > 20;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<ElementalMix>(), 45);
public override bool PreDraw(ref Color lightColor)
+3 -3
View File
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged
SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot, GunTipPosition); // Placeholder?
float sawDamageMult = MathHelper.Clamp(MathHelper.Lerp(1f, 5f, Time / ChargeupTime), 1f, 5f) / 2f; // The damage must be divided by 2 to offset the holdout having 2x base damage.
int sawPierce = (int)MathHelper.Clamp(MathHelper.Lerp(2f, 6f, Time / ChargeupTime), 2f, 6f);
int sawPierce = (int)MathHelper.Clamp(MathHelper.Lerp(2f, 7f, Time / ChargeupTime), 2f, 7f);
bool useSmallSlash = (Time / ChargeupTime) >= 0.25f;
bool useLargeSlash = (Time / ChargeupTime) >= 1f;
@@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged
Owner.AddCooldown(ElementalSawBoost.ID, ElementalSaw.DashCooldown);
Owner.Calamity().sBlasterDashActivated = true;
// TODO - Lingering saw on right click, and empowering saws
// TODO - Lingering saw on right click
// If moving, make particle effects when the dash activates
if (Owner.velocity != Vector2.Zero)
@@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Ranged
Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int e = 0; e < particleAmt; e++)
for (int e = 0; e < particleAmt * 2; e++)
{
Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1));
Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3));
+57 -22
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Ranged
// Controls if the saw is returning to the player.
public bool Returning = false;
public int ReturnTimer = 0;
public const int ReturnDelay = 90;
// Whether the saw is empowered by right click.
public bool Empowered = false;
@@ -53,26 +54,58 @@ namespace CalamityMod.Projectiles.Ranged
else
Empowered = false;
// While empowered, the saws while slightly home in on the cursor
if (Empowered && !Returning && Projectile.ai[1] > 30)
{
float homingTurnSpeed = 0.09f;
Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.MouseWorld).ToRotation(), homingTurnSpeed).ToRotationVector2() * ElementalSaw.ShootSpeed;
}
// Saws automatically return 2 seconds after hitting an enemy
if (ReturnTimer > 0 && ReturnTimer < 90)
if (ReturnTimer > 0 && ReturnTimer < ReturnDelay)
{
ReturnTimer++;
if (ReturnTimer == 90)
if (ReturnTimer == ReturnDelay)
Returning = true;
}
if (Returning)
{
Projectile.tileCollide = false;
if (ReturnTimer < 90)
ReturnTimer = 90;
if (ReturnTimer < ReturnDelay)
ReturnTimer = ReturnDelay;
ReturnTimer++;
if (ReturnTimer < 120)
if (ReturnTimer < ReturnDelay + 30)
Projectile.velocity *= 0.95f;
else
{
// Spawns a burst of homing bolts when it starts returning, based on how many tiles and enemies it hit
if (ReturnTimer == ReturnDelay + 30)
{
int boltPairs = Projectile.numHits;
for (int b = 0; b < boltPairs; b++)
{
for (int p = 0; p < 2; p++)
{
Vector2 randBoltVelocity = Main.rand.NextVector2CircularEdge(1f, 1f);
randBoltVelocity.SafeNormalize(Vector2.Zero);
randBoltVelocity *= 8f;
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randBoltVelocity, ModContent.ProjectileType<ElementalSawBullet>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
}
}
// Continously spawn homing bolts as it returns while empowered
if (ReturnTimer % 8 == 0 && Empowered)
{
Vector2 randVelocity = -Projectile.velocity.RotatedByRandom(MathHelper.PiOver2) / 2;
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randVelocity, ModContent.ProjectileType<ElementalSawBullet>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
float returnSpeed = (ElementalSaw.ShootSpeed * 0.66f) + (0.05f * (ReturnTimer - 120));
Vector2 ownerDist = Owner.Center - Projectile.Center;
if (ownerDist.Length() > 3000f)
@@ -81,7 +114,7 @@ namespace CalamityMod.Projectiles.Ranged
ownerDist.Normalize();
ownerDist *= returnSpeed;
// Home back in on the player.
// Home back in on the player; accelerates over time
if (Projectile.velocity.X < ownerDist.X)
Projectile.velocity.X = ownerDist.X;
else if (Projectile.velocity.X > ownerDist.X)
@@ -92,20 +125,12 @@ namespace CalamityMod.Projectiles.Ranged
else if (Projectile.velocity.Y > ownerDist.Y)
Projectile.velocity.Y = ownerDist.Y;
// Delete the saw if it touches its owner.
// Delete the saw if it touches its owner
if (Main.myPlayer == Projectile.owner)
{
if (Projectile.Hitbox.Intersects(Owner.Hitbox))
Projectile.Kill();
}
// Spawn homing bolts as it returns. These bolts spawn more often while empowered.
int boltFrequency = Empowered ? 7 : 10;
if (ReturnTimer % boltFrequency == 0)
{
Vector2 randVelocity = -Projectile.velocity.RotatedByRandom(MathHelper.PiOver2) / 2;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, randVelocity, ModContent.ProjectileType<ElementalSawBullet>(), (int)(Projectile.damage * 0.5f), 0f, Main.myPlayer);
}
}
}
}
@@ -137,17 +162,17 @@ namespace CalamityMod.Projectiles.Ranged
if (Projectile.velocity.Y != oldVelocity.Y)
Projectile.velocity.Y = -oldVelocity.Y;
Projectile.ai[2]--;
if (Projectile.ai[2] <= 0)
if (Projectile.ai[2] > 0)
{
Returning = true;
Projectile.ai[2]--;
Projectile.numHits++;
if (Projectile.ai[2] <= 0)
Returning = true;
}
return false;
}
public override bool? CanDamage() => !(Returning && Projectile.ai[2] == 0);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Laceration>(), 180);
@@ -157,9 +182,19 @@ namespace CalamityMod.Projectiles.Ranged
if (Projectile.numHits < 1)
ReturnTimer = 1;
Projectile.ai[2]--;
if (Projectile.ai[2] > 0)
{
Projectile.ai[2]--;
if (Projectile.ai[2] <= 0)
Returning = true;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// The saw deals less damage while returning, to prevent its damage being too crazy
if (Projectile.ai[2] <= 0)
Returning = true;
modifiers.SourceDamage *= 0.33f;
}
public override void OnKill(int timeLeft)