From 92ebab0bb39c83c55de13ad8a565c3e10cb5b5ef Mon Sep 17 00:00:00 2001 From: Xyk Date: Thu, 27 Jul 2023 23:31:48 -0700 Subject: [PATCH] Hammers Circular hitbox and crit fix Fixed the strange crit properties of the hammer line and gave all the explosions circular hitboxes. Also gave Pwnagehammer the GFB big hit sound because I forgot before. --- .../en-US/Mods.CalamityMod.Attunement.hjson | 2 +- .../Mods.CalamityMod.Projectiles.Melee.hjson | 2 + Projectiles/Melee/FallenBlast.cs | 5 +- Projectiles/Melee/FallenPaladinsHammerEcho.cs | 15 +--- Projectiles/Melee/GalaxySmasherBlast.cs | 35 ++++++++ Projectiles/Melee/GalaxySmasherEcho.cs | 14 +--- Projectiles/Melee/PwnagehammerEcho.cs | 8 +- Projectiles/Melee/StellarContemptBlast.cs | 35 ++++++++ Projectiles/Melee/StellarContemptEcho.cs | 80 ++++++++----------- 9 files changed, 118 insertions(+), 78 deletions(-) create mode 100644 Projectiles/Melee/GalaxySmasherBlast.cs create mode 100644 Projectiles/Melee/StellarContemptBlast.cs diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 2154098f50..3a9a3834b4 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -30,7 +30,7 @@ TropicalAttunement: { EvilAttunement: { Name: Decay's Retort - Function: + Function: ''' Lunge forward using a ghostly rapier projection that leeches life on enemy hits You will bounce away from struck targets diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 473d4517e0..650cef1892 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -359,3 +359,5 @@ PwnagehammerExplosionSmall.DisplayName: Pwnage Blast PwnagehammerExplosionBig.DisplayName: Pwnage Blast GalaxySmasherMini.DisplayName: Galaxy Smasher GalaxySmasherEcho.DisplayName: Galaxy Smasher Echo +StellarContemptBlast.DisplayName: Stellar Blast +GalaxySmasherBlast.DisplayName: Galactic Blast \ No newline at end of file diff --git a/Projectiles/Melee/FallenBlast.cs b/Projectiles/Melee/FallenBlast.cs index 27e6972fec..079c70016e 100644 --- a/Projectiles/Melee/FallenBlast.cs +++ b/Projectiles/Melee/FallenBlast.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() => Main.projFrames[Type] = 8; - + private static float ExplosionRadius = 236f; + public override void SetDefaults() { Projectile.width = 472; @@ -38,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Kill(); } - public override bool? CanDamage() => false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } } diff --git a/Projectiles/Melee/FallenPaladinsHammerEcho.cs b/Projectiles/Melee/FallenPaladinsHammerEcho.cs index 2feda808b7..4704e5ae1d 100644 --- a/Projectiles/Melee/FallenPaladinsHammerEcho.cs +++ b/Projectiles/Melee/FallenPaladinsHammerEcho.cs @@ -107,22 +107,9 @@ namespace CalamityMod.Projectiles.Melee else SoundEngine.PlaySound(SlamHamSound, Projectile.Center); Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 5; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - float distance = 248f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - Projectile.Center; - float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); - if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0]) - { - float alldamage = Projectile.damage * 0.5f; - double damage = npc.StrikeNPC(npc.CalculateHitInfo((int)alldamage, Projectile.velocity.X > 0f ? 1 : -1, true, Projectile.knockBack)); - player.addDPS((int)damage); - } - } return false; } diff --git a/Projectiles/Melee/GalaxySmasherBlast.cs b/Projectiles/Melee/GalaxySmasherBlast.cs new file mode 100644 index 0000000000..6150711d81 --- /dev/null +++ b/Projectiles/Melee/GalaxySmasherBlast.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxySmasherBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float ExplosionRadius = 568f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 568; + Projectile.height = 568; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index 20b87d8750..f3a680ecb4 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -133,20 +133,8 @@ namespace CalamityMod.Projectiles.Melee Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.5f, 11); GeneralParticleHandler.SpawnParticle(pulse2); - float distance = 568f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - Projectile.Center; - float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); - if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0]) - { - float alldamage = Projectile.damage * 0.5f; - double damage = npc.StrikeNPC(npc.CalculateHitInfo((int)alldamage, Projectile.velocity.X > 0f ? 1 : -1, true, Projectile.knockBack)); - player.addDPS((int)damage); - } - } return false; } diff --git a/Projectiles/Melee/PwnagehammerEcho.cs b/Projectiles/Melee/PwnagehammerEcho.cs index fb8483512b..d40065afb7 100644 --- a/Projectiles/Melee/PwnagehammerEcho.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public static readonly SoundStyle BigSound = new("CalamityMod/Sounds/Item/PwnagehammerBigImpact"); - public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f }; + public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f }; public int Explodamage = 0; public override void SetStaticDefaults() { @@ -115,7 +115,11 @@ namespace CalamityMod.Projectiles.Melee Main.dust[dust].scale = 3f; } - SoundEngine.PlaySound(BigSound, Projectile.Center); + if (Main.zenithWorld) + SoundEngine.PlaySound(Kunk, Projectile.Center); + + else + SoundEngine.PlaySound(BigSound, Projectile.Center); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); diff --git a/Projectiles/Melee/StellarContemptBlast.cs b/Projectiles/Melee/StellarContemptBlast.cs new file mode 100644 index 0000000000..819d4aaaf6 --- /dev/null +++ b/Projectiles/Melee/StellarContemptBlast.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StellarContemptBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float ExplosionRadius = 336f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 336; + Projectile.height = 336; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Melee/StellarContemptEcho.cs b/Projectiles/Melee/StellarContemptEcho.cs index 7e468ec4e1..2158bfc47b 100644 --- a/Projectiles/Melee/StellarContemptEcho.cs +++ b/Projectiles/Melee/StellarContemptEcho.cs @@ -128,54 +128,42 @@ namespace CalamityMod.Projectiles.Melee Main.dust[dust].velocity = velOffset; Main.dust[dust].scale = 3.8f; } - for (int i = 0; i < 88; ++i) - { - // Pick a random type of dust - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - dustID = 229; - break; - case 1: - case 2: - dustID = 156; - break; - default: - dustID = 156; - break; - } - - // Choose a random speed and angle for the dust - float dustSpeed = Main.rand.NextFloat(6.0f, 29.0f); - float angleRandom = 0.09f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the dust particle - float scale = Main.rand.NextFloat(2.2f, 4.8f); - - // Actually spawn the dust - int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - Main.dust[idx].position = Projectile.Center; - } - - float distance = 336f; - - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC npc = Main.npc[k]; - Vector2 vec = npc.Center - Projectile.Center; - float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); - if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0]) + for (int i = 0; i < 88; ++i) { - float alldamage = Projectile.damage * 0.5f; - double damage = npc.StrikeNPC(npc.CalculateHitInfo((int)alldamage, Projectile.velocity.X > 0f ? 1 : -1, true, Projectile.knockBack)); - player.addDPS((int)damage); - } + // Pick a random type of dust + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + dustID = 229; + break; + case 1: + case 2: + dustID = 156; + break; + default: + dustID = 156; + break; + } + + // Choose a random speed and angle for the dust + float dustSpeed = Main.rand.NextFloat(6.0f, 29.0f); + float angleRandom = 0.09f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the dust particle + float scale = Main.rand.NextFloat(2.2f, 4.8f); + + // Actually spawn the dust + int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = Projectile.Center; } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); + return false; }