diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index d1b4b08094..3fe824bcf6 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 28; - Item.damage = 15; + Item.damage = 37; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 28; + Item.knockBack = 5.75f; + Item.shootSpeed = 4f; + Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 18; - Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.15f; + public override float StealthDamageMultiplier => 1.15f; + + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; + return false; } - else - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); - } - return false; + return true; } public override void AddRecipes() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7461b8ec05..dd29ebdc93 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -717,8 +717,8 @@ MeteorFist: { DisplayName: Meteor Fist Tooltip: ''' - Fires a rocket fist that explodes forcefully - Stealth strikes make the fist ricochet between enemies up to 4 times + Fires a wired-guided rocket fist that seeks the cursor and accelerates over time + Stealth strikes immediately start accelerating and drop a meteorite on the struck enemy ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index cc518ff3b0..f625651d55 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -171,7 +171,7 @@ MangroveChakramProjectile.DisplayName: Mangrove Chakram MetalChunk.DisplayName: Metal Chunk MetalShard.DisplayName: Metal Shard MeteorFistProj.DisplayName: Meteor Fist Gud For A Lot Of Shtuff -MeteorFistStealth.DisplayName: Meteor Fist Gud For A Lot Of Shtuff +MeteorFistMeteorite.DisplayName: Meteorite REALLY Gud For A Lot Of Shtuff MoltenAmputatorProj.DisplayName: Molten Amputator MoltenBlobThrown.DisplayName: Molten Blob MoonSigil.DisplayName: Moon Sigil diff --git a/Projectiles/Rogue/MeteorFistMeteorite.cs b/Projectiles/Rogue/MeteorFistMeteorite.cs new file mode 100644 index 0000000000..5281f17885 --- /dev/null +++ b/Projectiles/Rogue/MeteorFistMeteorite.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MeteorFistMeteorite : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Backgrounds/Ambience/Meteor"; + + public override void SetDefaults() + { + Projectile.width = 62; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 360; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.scale = 2f; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 5 * Projectile.MaxUpdates) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) + Projectile.frame = 0; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + for (int i = 0; i < 2; i++) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height / 2, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + } + + if (Projectile.Center.Y > Main.npc[(int)Projectile.ai[0]].Center.Y) + Projectile.tileCollide = true; + } + + public override void OnKill(int timeLeft) + { + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HellbornImpact"), Projectile.Center); + + Projectile.ExpandHitboxBy(300); + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Damage(); + + for (int k = 0; k < 50; k++) + { + int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[boomDust2].noGravity = true; + Main.dust[boomDust2].velocity *= 5f; + boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + Main.dust[boomDust2].velocity *= 2f; + } + CustomPulse outerRing = new(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2.8f, 15); + GeneralParticleHandler.SpawnParticle(outerRing); + CustomPulse innerRing = new(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.8f, 30, true, 0.8f); + GeneralParticleHandler.SpawnParticle(innerRing); + } + + // Can hit if: + // 1: Is the same NPC the fist hit. 2: The NPC the fist hit is no longer active. 3: The fist hit a worm segment, and this NPC is another segment of the same worm. 4: Damage from the explosion. + public override bool? CanHitNPC(NPC target) => target.whoAmI == Projectile.ai[0] || !Main.npc[(int)Projectile.ai[0]].active || (target.realLife != -1 && target.realLife == Main.npc[(int)Projectile.ai[0]].realLife) || Projectile.penetrate == -1 ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire, 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 240); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, 4, 0, Projectile.frame); + SpriteEffects effect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() / 2f, Projectile.scale, effect); + return false; + } + } +} diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index 009cbfeda3..c572fa8a00 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -1,6 +1,10 @@ -using System; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,88 +15,131 @@ namespace CalamityMod.Projectiles.Rogue public class MeteorFistProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + public List Wire; + private const int Lifetime = 210; + private const int WireSegments = 15; + private const float MaxSpeed = 22.5f; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; + Projectile.penetrate = 2; // Only hits once, has 2 pierce to create a visual illusion of the connecting wire being left behind after hit + Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.velocity.Length() >= 4f) + Player Owner = Main.player[Projectile.owner]; + Timer++; + + // Initialize the connecting wire + if (Wire == null || Wire.Count < WireSegments) { - for (int i = 0; i < 2; i++) + Wire = new List(WireSegments); + for (int i = 0; i < WireSegments; i++) { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - dustyX = Projectile.velocity.X * 0.5f; - dustyY = Projectile.velocity.Y * 0.5f; - } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[meteorDust].velocity *= 0.2f; - Main.dust[meteorDust].noGravity = true; + VerletSimulatedSegment segment = new VerletSimulatedSegment(Owner.Center + Vector2.UnitY * i * 10f); + Wire.Add(segment); + } + + Wire[0].locked = true; + Wire[Wire.Count - 1].locked = true; + } + + // Spawn some fire dust, plus smoke if traveling fast enough + if (Projectile.numHits == 0) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + + if (Projectile.velocity.Length() >= 7f) + { + Vector2 smokePos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f; + HeavySmokeParticle smoking = new(smokePos, Vector2.UnitX.RotatedBy(Projectile.rotation + MathHelper.Pi) * 4f, Color.Orange, 5, 0.33f, 0.75f); + GeneralParticleHandler.SpawnParticle(smoking); } } - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) + if (Projectile.numHits == 0) { - Projectile.velocity *= 1.25f; + // Homing movement + Vector2 guidedDirection = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + float guidedSpeed = Timer < 60f && !Projectile.Calamity().stealthStrike ? 4f : (Timer + (Projectile.Calamity().stealthStrike ? 60f : 0f)) / 7.5f; + if (guidedSpeed > MaxSpeed) + guidedSpeed = MaxSpeed; + float guidedTurnStrength = MathHelper.Lerp(0.05f, Projectile.Calamity().stealthStrike ? 0.32f : 0.18f, Timer / (float)Lifetime); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Owner.ClampedMouseWorld()).ToRotation(), guidedTurnStrength).ToRotationVector2() * guidedSpeed * Owner.Calamity().rogueVelocity; + + // If you haven't hit anything, explode and leave the wire + if (Projectile.timeLeft == 2) + SetUpLeftoverWireEffect(); } - else if (Main.rand.NextBool()) + else { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + // Used for the sagging motion of the leftover wire + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; } - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.1f; - } + // Done to ensure the leftover wire is flush with the ground + Projectile.rotation = Projectile.numHits > 0 ? 0f : Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Wire[0].oldPosition = Wire[0].position; + Wire[0].position = Owner.Center; + Wire[Wire.Count - 1].oldPosition = Wire[0].position; + Wire[Wire.Count - 1].position = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * (Projectile.numHits > 0 ? 14f : 8f); + Wire = VerletSimulatedSegment.SimpleSimulation(Wire, 10, loops: 1, gravity: 0.3f); } - public override void OnKill(int timeLeft) + // Both of these are done for wire leftover effect + public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) + if (Projectile.numHits == 0) + SetUpLeftoverWireEffect(); + return false; + } + public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; + + // Fuck off stupid Vile Spits + public override bool? CanHitNPC(NPC target) => NPCID.Sets.ProjectileNPC[target.type] ? false : null; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.OnFire, 120); + if (Main.myPlayer == Projectile.owner) { - int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust].velocity *= 3f; - if (Main.rand.NextBool()) + // Stealth strikes drop a whole ass meteorite because hell yeah + if (Projectile.Calamity().stealthStrike) { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Vector2 meteorSpawn = target.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-650f, -750f)); + Vector2 meteorVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(meteorSpawn, target, 15f, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), meteorSpawn, meteorVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2, Projectile.owner, target.whoAmI); } } - for (int k = 0; k < 70; k++) + + // Visual effects + SetUpLeftoverWireEffect(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + + private void SetUpLeftoverWireEffect() + { + Projectile.numHits++; + Timer = 0f; + Projectile.timeLeft = 90; + + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + for (int k = 0; k < 30; k++) { int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[boomDust2].noGravity = true; @@ -103,55 +150,45 @@ namespace CalamityMod.Projectiles.Rogue if (Main.netMode != NetmodeID.Server) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = new Vector2(Projectile.Center.X - 24f, Projectile.Center.Y - 24f); + for (int g = 1; g <= 3; g++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + float velocityMult = g * 0.33f; + for (int spawn = 0; spawn < 2; spawn++) { - velocityMult = 0.66f; + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public float WidthFunction(float completionRatio) => 0.4f; + public Color ColorFunction(float completionRatio) { - target.AddBuff(BuffID.OnFire, 120); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + float fadeThreshold = 60f; + float opacity = Projectile.numHits > 0 && Timer > fadeThreshold ? MathHelper.Lerp(0.75f, 0f, (Timer - fadeThreshold) / 30f) : 0.75f; + return Color.Orange * opacity; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + public override bool PreDraw(ref Color lightColor) + { + // Draw the wire + List wirePoints = new List(); + if (Wire != null && Wire.Count > 0) + { + for (int i = 0; i < Wire.Count; i++) + { + wirePoints.Add(Wire[i].position); + } + } + PrimitiveRenderer.RenderTrail(wirePoints, new(WidthFunction, ColorFunction), 75); + + // Fist itself only draws if it hasn't hit + // After hitting, the fist stops drawing, creating the illusion of the wire being left behind + return Projectile.numHits == 0; + } } } diff --git a/Projectiles/Rogue/MeteorFistStealth.cs b/Projectiles/Rogue/MeteorFistStealth.cs deleted file mode 100644 index a70b1fae0a..0000000000 --- a/Projectiles/Rogue/MeteorFistStealth.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MeteorFistStealth : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Rogue/MeteorFistProj"; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.velocity.Length() >= 4f) - { - for (int i = 0; i < 2; i++) - { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - dustyX = Projectile.velocity.X * 0.5f; - dustyY = Projectile.velocity.Y * 0.5f; - } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[meteorDust].velocity *= 0.2f; - Main.dust[meteorDust].noGravity = true; - } - } - - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) - { - Projectile.velocity *= 1.25f; - } - else if (Main.rand.NextBool()) - { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) - { - int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 70; k++) - { - int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[boomDust2].noGravity = true; - Main.dust[boomDust2].velocity *= 5f; - boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire, 120); - int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Projectile.damage = (int)(Projectile.damage * 0.6666); - float minDist = 999f; - int index = 0; - // Get the closest enemy to the fist - if (Projectile.penetrate != -1) - { - foreach (var npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false) && npc != target) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - Vector2 newFistVelocity; - if (minDist < 999f) - { - newFistVelocity = Main.npc[index].Center - Projectile.Center; - } - else - { - newFistVelocity = -Projectile.velocity; - } - newFistVelocity.Normalize(); - newFistVelocity *= 10f; - Projectile.velocity = newFistVelocity; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); - } -} diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index 124c62f58a..017bdfe455 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -10,9 +10,6 @@ namespace CalamityMod.Projectiles.Rogue public class TalonSmallProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private static float SineFrequency = 0.05f; - private static float SineAmplitude = 0.008f; - private static float RotationIncrement = 0.26f; public override void SetDefaults() {