diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index d4481c4ce4..0099ee01c2 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Gel Dart"); - Tooltip.SetDefault("Throws bouncing darts"); + Tooltip.SetDefault("Throws bouncing darts\n" + + "Stealth strikes ignore gravity and bounce more vigorously\n" + + "They additionally leak slime and cover enemies in dark sludge"); } public override void SafeSetDefaults() @@ -35,5 +38,19 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 14f; item.Calamity().rogue = true; } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].penetrate = 6; + Main.projectile[stealth].aiStyle = -1; + return false; + } + return true; + } } } diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index d41955a085..7b907b373d 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic { public class EventHorizonStar : ModProjectile { - private int counter = 0; + private bool initialized = false; Vector2 initialPosition; public override void SetStaticDefaults() @@ -58,10 +58,10 @@ namespace CalamityMod.Projectiles.Magic float centerX = projectile.Center.X; float centerY = projectile.Center.Y; - if (counter == 0) + if (!initialized) { initialPosition = playerCenter; - counter++; + initialized = true; } else if (playerCenter != initialPosition) { diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 0f03b231b3..802883ddcf 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,6 +26,22 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } + public override void AI() + { + if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + if (projectile.timeLeft % 8 == 0) + { + Vector2 velocity = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int flame = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SlimeGun, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Main.projectile[flame].Calamity().forceRogue = true; + Main.projectile[flame].usesLocalNPCImmunity = true; + Main.projectile[flame].localNPCHitCooldown = 10; + } + } + } + public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; @@ -34,15 +51,26 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } + if (projectile.Calamity().stealthStrike) + { + if (projectile.velocity != oldVelocity) + { + projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * 1.35f; + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 56); //minecart bumper sound + } + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } } return false; } @@ -65,11 +93,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Slimed, 120); + if (projectile.Calamity().stealthStrike) + target.AddBuff(BuffID.Slow, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Slimed, 120); + if (projectile.Calamity().stealthStrike) + target.AddBuff(BuffID.Slow, 120); } } }