From 163c192d330f65ea256a8edbae48cf7b3f892ca9 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 18 Jul 2023 13:19:13 -0700 Subject: [PATCH] Stellar Striker Updates Now summons lunar flares on hit The sound of the "gong" goes up in pitch from the first to the 5th hit before the big hammer. Big hammer now has a bit of screenshake Other small edits to damage and dust --- Items/Weapons/Melee/StellarContempt.cs | 6 +- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 3 +- Projectiles/Melee/StellarContemptEcho.cs | 9 +-- Projectiles/Melee/StellarContemptHammer.cs | 64 ++++++++++++++++--- 4 files changed, 66 insertions(+), 16 deletions(-) diff --git a/Items/Weapons/Melee/StellarContempt.cs b/Items/Weapons/Melee/StellarContempt.cs index be3bc76a15..24efd195e2 100644 --- a/Items/Weapons/Melee/StellarContempt.cs +++ b/Items/Weapons/Melee/StellarContempt.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Melee; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Materials; namespace CalamityMod.Items.Weapons.Melee { @@ -8,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee public class StellarContempt : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - public static int BaseDamage = 800; + public static int BaseDamage = 678; public static float Speed = 25f; public override void SetDefaults() @@ -39,8 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(ItemID.FragmentSolar, 10). - AddIngredient(ItemID.FragmentNebula, 10). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 751f8e366e..661571f2a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1018,7 +1018,8 @@ StellarContempt: { DisplayName: Stellar Contempt Tooltip: ''' - Throws a heavy, gravity-affected hammer that will return to you after striking an enemy + Throws a heavy, gravity-affected hammer that summons lunar flares upon hitting an enemy + After striking an enemy the hammer will return to you Every fifth hit, the hammer will charge with lunar energy and eviscerate whatever it hits ''' } diff --git a/Projectiles/Melee/StellarContemptEcho.cs b/Projectiles/Melee/StellarContemptEcho.cs index c3a8a51d1a..771a4bea9e 100644 --- a/Projectiles/Melee/StellarContemptEcho.cs +++ b/Projectiles/Melee/StellarContemptEcho.cs @@ -108,6 +108,7 @@ namespace CalamityMod.Projectiles.Melee { Player player = Main.player[Projectile.owner]; //This is what we call fucking IMPACT. + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 7; SoundEngine.PlaySound(SlamHamSound, Projectile.Center); float numberOfDusts = 156f; @@ -129,14 +130,14 @@ namespace CalamityMod.Projectiles.Melee switch (Main.rand.Next(6)) { case 0: - dustID = 156; + dustID = 229; break; case 1: case 2: - dustID = 229; + dustID = 156; break; default: - dustID = 229; + dustID = 156; break; } @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[idx].position = Projectile.Center; } - float distance = 272f; + float distance = 336f; for (int k = 0; k < Main.maxNPCs; k++) { diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 723bad975b..5f3d3a4949 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarContempt"; - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f, PitchVariance = 0.3f }; - public static readonly SoundStyle HomingSound = new("CalamityMod/Sounds/Item/PwnagehammerHoming") { Volume = 0.3f, PitchVariance = 0.3f }; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f}; public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/StellarContemptClone") { Volume = 1f}; private static float StartDustQuantity = 26f; public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer; @@ -44,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - //returnhammer determines if the hammer is slowing down after hitting an enemy, or homing in o0n the player. + //returnhammer determines if the hammer is slowing down after hitting an enemy, or homing in on the player. Player player = Main.player[Projectile.owner]; Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction; @@ -70,14 +69,14 @@ namespace CalamityMod.Projectiles.Melee switch (Main.rand.Next(6)) { case 0: - dustID = 156; + dustID = 229; break; case 1: case 2: - dustID = 229; + dustID = 156; break; default: - dustID = 229; + dustID = 156; break; } @@ -192,7 +191,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0f; SoundEngine.PlaySound(RedHamSound, Projectile.Center); - int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 5, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]); + int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 6, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; EmpoweredHammer = 0; @@ -223,12 +222,16 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[Projectile.owner]; if (returnhammer == 0) { - SoundEngine.PlaySound(UseSound, Projectile.Center); + SoundEngine.PlaySound(UseSound with { Pitch = EmpoweredHammer * 0.1f - 0.1f }, Projectile.Center); if (EmpoweredHammer == 4) { Projectile.velocity.Y *= 0f; Projectile.velocity.X *= 0f; } + else + { + SpawnFlares(target.Center, target.width, target.height); + } returnhammer = 1; } float numberOfDusts = 40f; @@ -253,6 +256,51 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.damage < 1) Projectile.damage = 1; } + + private void SpawnFlares(Vector2 targetPos, int width, int height) + { + // Play the Lunar Flare sound centered on the user, not the target (consistent with Lunar Flare and Stellar Striker) + Player user = Main.player[Projectile.owner]; + SoundEngine.PlaySound(SoundID.Item88, Projectile.position); + Projectile.netUpdate = true; + + int numFlares = EmpoweredHammer + 1; + int flareDamage = (int)(0.1f * Projectile.damage); + float flareKB = 4f; + for (int i = 0; i < numFlares; ++i) + { + float flareSpeed = Main.rand.NextFloat(9f, 13f); + + // Flares never come from straight up, there is always at least an 80 pixel horizontal offset + float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); + float yDist = Main.rand.NextFloat(1200f, 1440f); + Vector2 startPoint = targetPos + new Vector2(xDist, -yDist); + + // The flare is somewhat inaccurate based on the size of the target. + float xVariance = width / 4f; + if (xVariance < 8f) + xVariance = 8f; + float yVariance = height / 4f; + if (yVariance < 8f) + yVariance = 8f; + float xOffset = Main.rand.NextFloat(-xVariance, xVariance); + float yOffset = Main.rand.NextFloat(-yVariance, yVariance); + Vector2 offsetTarget = targetPos + new Vector2(xOffset, yOffset); + + // Finalize the velocity vector and make sure it's going at the right speed. + Vector2 velocity = offsetTarget - startPoint; + velocity.Normalize(); + velocity *= flareSpeed; + + float AI1 = Main.rand.Next(3); + if (Projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed; + } + } + } public override bool PreDraw(ref Color lightColor) {