Sup Slaughterer balance and right-click change
This commit is contained in:
1 parent
d883e0dcaa
commit
a375770d5f
4 files changed
+65
-43
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.CalPlayer.Dashes;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
@@ -21,9 +22,12 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
|
||||
public const float ShootSpeed = 24f;
|
||||
|
||||
public const int DashCooldown = 360;
|
||||
|
||||
public bool hasDashed = false;
|
||||
public int rightClickDelay = 0;
|
||||
public static int doubleRightFrameWindow = 23;
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
{
|
||||
if (tooltips == null)
|
||||
@@ -55,10 +59,10 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 84;
|
||||
Item.height = 46;
|
||||
Item.damage = 127;
|
||||
Item.damage = 97;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
Item.useTime = 10;
|
||||
Item.useAnimation = 10;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
@@ -75,13 +79,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
// Terraria seems to really dislike high crit values in SetDefaults
|
||||
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21;
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2 && player.HasCooldown(SuperradiantSawBoost.ID))
|
||||
return false;
|
||||
else
|
||||
return player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
}
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
@@ -91,6 +89,11 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
player.Calamity().rightClickListener = true;
|
||||
|
||||
if (rightClickDelay > 0)
|
||||
rightClickDelay--;
|
||||
if (!player.HasCooldown(SuperradiantSawBoost.ID))
|
||||
hasDashed = false;
|
||||
|
||||
// Right-click channeling
|
||||
if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse && !player.HasCooldown(SuperradiantSawBoost.ID))
|
||||
{
|
||||
@@ -108,9 +111,24 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
// The holdout will initially double up when right clicking otherwise
|
||||
// Handles allowing the dash
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
bool doubleRightClick = rightClickDelay > 0 && !hasDashed;
|
||||
bool canDash = doubleRightClick && player.Calamity().DashID != SuperradiantSawDash.ID;
|
||||
|
||||
// If you hit the right-click window, dash
|
||||
if (canDash)
|
||||
{
|
||||
hasDashed = true;
|
||||
player.Calamity().sBlasterDashActivated = true;
|
||||
}
|
||||
|
||||
// Set the double right-click frames
|
||||
rightClickDelay = doubleRightFrameWindow;
|
||||
// The holdout will initially double up when right clicking otherwise
|
||||
return false;
|
||||
}
|
||||
|
||||
// The holdout deals 2x base damage.
|
||||
Projectile.NewProjectile(source, position, velocity, Item.shoot, damage * 2, knockback, player.whoAmI);
|
||||
|
||||
@@ -1248,7 +1248,7 @@ SuperradiantSlaughterer: {
|
||||
AltInfo:
|
||||
'''
|
||||
Press <right> to eject a lingering buzzsaw towards the cursor that fires homing bolts
|
||||
Using this ability rapidly propels you in the direction you are moving
|
||||
Double <right> to rapidly propel yourself in the direction you are moving
|
||||
This ability has a {0} second cooldown
|
||||
During this cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning
|
||||
'''
|
||||
|
||||
@@ -243,7 +243,10 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
PierceBeforeReturn--;
|
||||
Projectile.numHits++;
|
||||
if (PierceBeforeReturn <= 0)
|
||||
{
|
||||
Projectile.localNPCHitCooldown = 20;
|
||||
Returning = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -290,15 +293,18 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
PierceBeforeReturn--;
|
||||
if (PierceBeforeReturn <= 0)
|
||||
{
|
||||
Projectile.localNPCHitCooldown = 20;
|
||||
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 (PierceBeforeReturn <= 0)
|
||||
modifiers.SourceDamage *= 0.33f;
|
||||
// The saw also deals less damage while homing
|
||||
modifiers.SourceDamage *= Returning ? 0.2f : Empowered ? 0.75f : 1f;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
|
||||
@@ -74,44 +74,42 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle) && Idle.IsPlaying)
|
||||
Idle.Position = GunTipPosition;
|
||||
|
||||
// Handle the right-click dash (holds priority over left-click)
|
||||
// Handle the right-click dash (only works when not used from left-click)
|
||||
if (Owner.Calamity().mouseRight && !Owner.HasCooldown(SuperradiantSawBoost.ID))
|
||||
{
|
||||
Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown);
|
||||
Owner.Calamity().sBlasterDashActivated = true;
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition);
|
||||
|
||||
// Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x)
|
||||
float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f);
|
||||
float adjustedMouseDist = clampedMouseDist / 21f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType<SuperradiantSawLingering>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
|
||||
|
||||
// Special case: right-clicking while not holding left-click
|
||||
// This is to keep it friendly to use both fires at the same time, but end the animation early if not
|
||||
if (Projectile.ai[1] >= 2f)
|
||||
{
|
||||
Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown);
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition);
|
||||
|
||||
// Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x)
|
||||
float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f);
|
||||
float adjustedMouseDist = clampedMouseDist / 21f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType<SuperradiantSawLingering>(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner);
|
||||
|
||||
// End animation early
|
||||
NoSawOnHoldout = true;
|
||||
OffsetLengthFromArm -= 16f;
|
||||
Projectile.timeLeft = Owner.ActiveItem().useAnimation;
|
||||
KeepRefreshingLifetime = false;
|
||||
Idle?.Stop();
|
||||
}
|
||||
|
||||
// If moving, make particle effects when the dash activates
|
||||
if (Owner.velocity != Vector2.Zero)
|
||||
{
|
||||
int particleAmt = 7;
|
||||
for (int c = 0; c < particleAmt; c++)
|
||||
// If moving, make particle effects when the dash activates
|
||||
if (Owner.velocity != Vector2.Zero)
|
||||
{
|
||||
Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1));
|
||||
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 * 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));
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
int particleAmt = 7;
|
||||
for (int c = 0; c < particleAmt; c++)
|
||||
{
|
||||
Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1));
|
||||
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 * 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));
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user