diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index b83c6a9340..2f5f857dde 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -5,11 +5,17 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using Steamworks; +using Terraria.Audio; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons.Rogue { public class Turbulance : RogueWeapon { + public static SoundStyle LightningStrike = new SoundStyle("CalamityMod/Sounds/Item/TurbulanceLightningStrike"); + public override void SetDefaults() { Item.width = 14; @@ -20,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; Item.knockBack = 5f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 14; Item.value = CalamityGlobalItem.Rarity3BuyPrice; @@ -30,15 +35,51 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.Calamity().mouseWorldListener = true; + + Vector2 mW = player.Calamity().mouseWorld; + + float value1 = player.direction * -90; + float value2 = player.direction * 180; + float value3 = player.direction * -240; + + float g1 = (float)Item.useAnimation; + float g2 = (float)player.itemAnimation; + + float gg = g2 / g1; + + player.direction = Math.Sign(mW.X - player.Center.X); + if (player.direction == 0) player.direction = 1; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.AngleTo(mW) + (player.direction == 1 ? MathHelper.ToRadians(180) : 0) + MathHelper.ToRadians(MathHelper.Lerp(value2, value1, CalamityUtils.SineInOutEasing(gg, 1)))); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.AngleTo(mW) + (player.direction == 1 ? MathHelper.ToRadians(180) : 0) + MathHelper.ToRadians(MathHelper.Lerp(value1, value3, CalamityUtils.SineInOutEasing(gg, 1)))); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + player.Calamity().mouseWorldListener = true; + + Vector2 SpawnPos = player.MountedCenter + new Vector2(0, -16); + Vector2 vel = velocity; + + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing.WithPitchOffset(0.8f), player.MountedCenter); + + if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; + SoundEngine.PlaySound(WulfrumKnife.Throw1Sound, player.MountedCenter); + + vel *= 0.15f; } + + int proj = Projectile.NewProjectile(source, SpawnPos, SpawnPos.DirectionTo(player.Calamity().mouseWorld) * vel.Length(), type, damage, knockback, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override bool CanShoot(Player player) + { return true; } diff --git a/Items/Weapons/Rogue/Turbulance.png b/Items/Weapons/Rogue/Turbulance.png index ea99f75e85..bc1b4cd897 100644 Binary files a/Items/Weapons/Rogue/Turbulance.png and b/Items/Weapons/Rogue/Turbulance.png differ diff --git a/Particles/ImpactParticle.cs b/Particles/ImpactParticle.cs index 2b380cf52e..833ee0d4ce 100644 --- a/Particles/ImpactParticle.cs +++ b/Particles/ImpactParticle.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Particles Vector2 scale = new Vector2(0.3f, 1f) * scaleFactor; Texture2D texture = ModContent.Request(Texture).Value; - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, 0f, texture.Size() * 0.5f, scale, 0, 0f); - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, -Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, 0f, texture.Size() * 0.5f, scale * Scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * Scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, -Rotation, texture.Size() * 0.5f, scale * Scale, 0, 0f); } } } diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index e5ba363ca7..64daab5422 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -2,6 +2,9 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Rogue; namespace CalamityMod.Projectiles.Rogue { @@ -29,6 +32,16 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + if (!Projectile.Calamity().stealthStrike) + { + Projectile.velocity.Y += 0.05f; + Projectile.velocity.X *= 0.995f; + } + else + { + Projectile.velocity *= 1.05f; + } + Projectile.ai[0]++; Projectile.tileCollide = Projectile.ai[0] >= 2f; @@ -36,27 +49,47 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); + dust.noGravity = true; } if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust dust = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + dust.noGravity = true; } if (Projectile.Calamity().stealthStrike) //Stealth strike { - if (Projectile.timeLeft % 14 == 0) + if (Projectile.ai[0] % 4 == 1) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, 1f, 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack / 2, Projectile.owner, 1f, 1f); + proj.Calamity().stealthStrike = true; } } } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 10; i++) + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); + + GeneralParticleHandler.SpawnParticle(new ImpactParticle( + Projectile.Center, MathHelper.ToRadians(Main.rand.NextFloat(-2, 2)), 20, 2f, Color.SkyBlue)); + for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 50, new Color(53, Main.DiscoG, 255)); + GeneralParticleHandler.SpawnParticle(new ImpactParticle( + Projectile.Center + new Vector2(Main.rand.NextFloat(20, 50), 0).RotatedByRandom(MathHelper.TwoPi), MathHelper.ToRadians(Main.rand.NextFloat(-2, 2)), 20, 0.5f, Color.SkyBlue)); + } + + if (Projectile.Calamity().stealthStrike) + { + SoundEngine.PlaySound(Turbulance.LightningStrike, Projectile.Center); + + for (int i = 0; i <= 10; i++) + { + GeneralParticleHandler.SpawnParticle( + new CrackParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20, 50), 0).RotatedByRandom(MathHelper.TwoPi), Vector2.Zero, Color.Gold, new Vector2(Main.rand.NextFloat(1f, 2f), Main.rand.NextFloat(2f)), Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 30) + ); + } } } diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 8804d3b7e1..559cf17b35 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -1,3 +1,4 @@ +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.velocity *= 0.99f; + Projectile.velocity *= 0.9f; if (Projectile.localAI[0] == 0f) { Projectile.scale += 0.005f; @@ -54,13 +55,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame = 0; } } - if (Projectile.ai[0] == 1f) //stealth strike + if (Projectile.Calamity().stealthStrike) //stealth strike { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - } - if (Projectile.ai[1] == 1f) - { - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, Projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 450f, 8f, 20f); } } @@ -72,10 +69,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 187, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); - } + } } } diff --git a/Sounds/Item/TurbulanceLightningStrike.mp3 b/Sounds/Item/TurbulanceLightningStrike.mp3 new file mode 100644 index 0000000000..4d7b099759 Binary files /dev/null and b/Sounds/Item/TurbulanceLightningStrike.mp3 differ