diff --git a/Graphics/Metaballs/PhotoMetaball3.cs b/Graphics/Metaballs/PhotoMetaball3.cs index 9ddc7f2e1c..cfb21ea60d 100644 --- a/Graphics/Metaballs/PhotoMetaball3.cs +++ b/Graphics/Metaballs/PhotoMetaball3.cs @@ -62,16 +62,18 @@ namespace CalamityMod.Graphics.Metaballs Particles[i].Update(); Particles.RemoveAll(p => p.Size <= 2f); - if (Time % 10 == 0) + List eColors = new List() { - sparkColor = Main.rand.Next(4) switch - { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, - }; - } + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen + }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); } // Copied from Rancor Lava metaballs, since these need to be additive metaballs. diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 42ce03ed24..55d6af9366 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -12,15 +12,18 @@ namespace CalamityMod.Items.Weapons.Ranged public class Hellborn : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() => ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; - + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + } public override void SetDefaults() { Item.width = 62; Item.height = 34; Item.damage = 475; Item.DamageType = DamageClass.Ranged; - Item.useAnimation = Item.useTime = 35; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2.5f; @@ -40,30 +43,18 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => true; public override void HoldItem(Player player) { - if (player.whoAmI != Main.myPlayer) - return; - - // Right-click channeling - player.Calamity().rightClickListener = true; - - if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse) - { - // Only one out at a time - if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) - return; - - var source = player.GetSource_ItemUse(player.ActiveItem()); - Projectile holdout = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, Item.shoot, player.ActiveItem().damage, 0f, player.whoAmI, 0, 0, 5); - holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - } + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Only one out at a time if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) return false; - - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 0); + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 5448aaed46..60b4d83186 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -25,7 +25,11 @@ namespace CalamityMod.Items.Weapons.Ranged // Right-click stats public static float RightClickVelocityMult = 2.5f; - public static int RightClickCooldown = 30; + public static int RightClickCooldown = 25; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } public override void SetDefaults() { @@ -55,33 +59,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override void HoldItem(Player player) { - if (player.whoAmI != Main.myPlayer) - return; - - // Right-click channeling - player.Calamity().rightClickListener = true; - - if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse) - { - // Only one out at a time - if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) - return; - // If you don't have any Gel don't even spawn the holdout - if (!player.HasAmmo(Item)) - return; - - var source = player.GetSource_ItemUse_WithPotentialAmmo(Item, ItemID.Gel); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, Item.shoot, 0, 0f, player.whoAmI); - } + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // The holdout will initially double up when right clicking otherwise if (player.altFunctionUse == 2f) - return false; - - Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); + { + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); + else + return false; + } + else + Projectile.NewProjectile(source, position, Vector2.Zero, type, 0, 0f, player.whoAmI); return false; } diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index bee146a793..66d0d867ba 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; @@ -39,25 +40,38 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - sparkColor = Main.rand.Next(4) switch + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + Time++; Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.2f); - Player Owner = Main.player[Projectile.owner]; - float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); //used for some drawing prevention for when it's offscreen since it makes a fuck load of particles + if (targetDist < 1400f) { - if (PhotoTimer == 0) - PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, 42 - Time * 0.165f); - if (PhotoTimer == 1) - PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); ; + //if (PhotoTimer == 0) + //PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, 42 - Time * 0.165f); + //if (PhotoTimer == 1) + //PhotoMetaball3.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); ; - PhotoMetaball4.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); + //PhotoMetaball4.SpawnParticle(Projectile.Center + Owner.velocity, (37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)); + + // I hate metaballs >:( + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.005f, sparkColor, new Vector2(1f, 1 + Time * 0.1f), true, false); + GeneralParticleHandler.SpawnParticle(beam3); + Particle beam32 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.5f, 4f), "CalamityMod/Particles/SmallBloom", false, 4, ((37 - Time * (PhotoTimer == 0 ? 0.165f : 0.088f)) - PhotoTimer * 0.2f + (PhotoTimer == 1 ? 20 : 0)) * 0.003f, Color.Lerp(Color.White, sparkColor, 0.5f), new Vector2(1f, 1 + Time * 0.1f), true, false); + GeneralParticleHandler.SpawnParticle(beam32); } if (Main.rand.NextBool(35) && targetDist < 1400f && Time > 5) { diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index ec64d7a017..dad4a00579 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -1,4 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; @@ -36,16 +38,35 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Time++; - sparkColor = Main.rand.Next(4) switch + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; - PhotoMetaball.SpawnParticle(Projectile.Center, 90); - PhotoMetaball2.SpawnParticle(Projectile.Center, 85); + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + if (targetDist < 1400) + { + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.01f, 0.1f), "CalamityMod/Particles/SmallBloom", false, 3, 0.4f, sparkColor, new Vector2(1f, 1), true, true); + GeneralParticleHandler.SpawnParticle(beam3); + + float sine = (float)Math.Sin(Projectile.timeLeft * 0.875f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 18.5f; + + Particle beam33 = new CustomSpark(Projectile.Center + offset, Projectile.velocity * Main.rand.NextFloat(0.01f, 0.1f), "CalamityMod/Particles/SmallBloom", false, 23, 0.2f, sparkColor, new Vector2(1f, 1), true, true); + GeneralParticleHandler.SpawnParticle(beam33); + } + CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 12f, 20f); } @@ -59,7 +80,7 @@ namespace CalamityMod.Projectiles.Ranged float rot = MathHelper.ToRadians(i * rotFactorlines); Vector2 offset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f)); Vector2 velOffset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f)); - SparkParticle spark = new SparkParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(3.5f, 6.5f), true, 95, Main.rand.NextFloat(0.3f, 0.8f), Color.White); + Particle spark = new GlowSparkParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(5.5f, 8.5f), true, 75, Main.rand.NextFloat(0.03f, 0.05f), sparkColor, new Vector2(0.3f, 1f)); GeneralParticleHandler.SpawnParticle(spark); float rot2 = MathHelper.ToRadians(i * rotFactorlines); @@ -69,6 +90,10 @@ namespace CalamityMod.Projectiles.Ranged SquishyLightParticle exoEnergy = new(Projectile.Center + offset2, velOffset2 * Main.rand.NextFloat(0.5f, 2.5f), 0.5f, sparkColor, 35); GeneralParticleHandler.SpawnParticle(exoEnergy); } + + Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, sparkColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.2f, 1.8f * Main.rand.NextFloat(0.9f, 1.1f), 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + if (audioCooldown == 0) { SoundEngine.PlaySound(Photoviscerator.HitSound, target.Center); diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index d9b146600d..7bb14a76f5 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; @@ -56,16 +57,21 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - PhotoMetaball.SpawnParticle(Projectile.Center, 54); - PhotoMetaball2.SpawnParticle(Projectile.Center, 50); - - sparkColor = Main.rand.Next(4) switch + List eColors = new List() { - 0 => Color.Red, - 1 => Color.MediumTurquoise, - 2 => Color.Orange, - _ => Color.LawnGreen, + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Particle beam3 = new CustomSpark(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.01f, 0.1f), "CalamityMod/Particles/SmallBloom", false, 13, 0.2f, sparkColor, new Vector2(1f, 1), true, true); + GeneralParticleHandler.SpawnParticle(beam3); Lighting.AddLight(Projectile.Center, Color.DarkSlateGray.ToVector3()); Projectile.scale = MathHelper.Lerp(0.001f, 1f, Utils.GetLerpValue(0f, 25f, Time, true)); diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index 2b5d81ed2c..0d13e87d20 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -21,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public ref float ShootTimer => ref Projectile.ai[0]; public ref float ForcedLifespan => ref Projectile.ai[1]; public Color sparkColor; + public Color sparkColorSmooth; public int Time = 0; public ref int PhotoTimer => ref Main.player[Projectile.owner].Calamity().PhotoTimer; public SlotId PhotoUseSound; @@ -54,6 +56,19 @@ namespace CalamityMod.Projectiles.Ranged _ => Color.LawnGreen, }; + List eColors = new List() + { + Color.OrangeRed, + Color.MediumTurquoise, + Color.Orange, + Color.LawnGreen + }; + float rate = (Main.GlobalTimeWrappedHourly * 8); + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + sparkColorSmooth = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + if (Owner.Calamity().mouseRight) { if (SoundEngine.TryGetActiveSound(PhotoUseSound, out var Sound2)) @@ -152,7 +167,7 @@ namespace CalamityMod.Projectiles.Ranged 2 => Color.Orange, _ => Color.LawnGreen, }; - SquishyLightParticle exoEnergy = new(position, (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1.6f), 0.9f, sparkColor, 60); + SquishyLightParticle exoEnergy = new(position, (Projectile.velocity * 3).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.3f, 1.6f), 0.9f, sparkColorSmooth, 60); GeneralParticleHandler.SpawnParticle(exoEnergy); } SoundEngine.PlaySound(DeadSunsWind.ShootSound with { Volume = 1.9f }, Owner.MountedCenter); @@ -161,16 +176,16 @@ namespace CalamityMod.Projectiles.Ranged Dust dust = Dust.NewDustPerfect(position, 263, (Projectile.velocity * 10).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.6f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(1.3f, 1.8f) - PhotoTimer * 0.02f; - dust.color = sparkColor; + dust.color = sparkColorSmooth; Dust dust2 = Dust.NewDustPerfect(position, 263, (Projectile.velocity * 15).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.3f, 1.6f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(1.3f, 1.8f) - PhotoTimer * 0.02f; - dust2.color = sparkColor; + dust2.color = sparkColorSmooth; if (Main.rand.NextBool()) { - MediumMistParticle smoke = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 15).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.5f, 2.1f), sparkColor, Color.White, Main.rand.NextFloat(1.8f, 2.9f) - PhotoTimer * 0.026f, 160, Main.rand.NextFloat(-3f, 3f)); + MediumMistParticle smoke = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 15).RotatedByRandom(0.15f) * Main.rand.NextFloat(0.5f, 2.1f), sparkColorSmooth, Color.White, Main.rand.NextFloat(1.8f, 2.9f) - PhotoTimer * 0.026f, 160, Main.rand.NextFloat(-3f, 3f)); GeneralParticleHandler.SpawnParticle(smoke); - MediumMistParticle smoke2 = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 18).RotatedByRandom(0.05f) * Main.rand.NextFloat(1.8f, 3.1f), sparkColor, Color.White, Main.rand.NextFloat(0.8f, 1.9f) - PhotoTimer * 0.02f, 160, Main.rand.NextFloat(-3f, 3f)); + MediumMistParticle smoke2 = new MediumMistParticle(position + Main.rand.NextVector2Circular(5, 5), (Projectile.velocity * 18).RotatedByRandom(0.05f) * Main.rand.NextFloat(1.8f, 3.1f), sparkColorSmooth, Color.White, Main.rand.NextFloat(0.8f, 1.9f) - PhotoTimer * 0.02f, 160, Main.rand.NextFloat(-3f, 3f)); GeneralParticleHandler.SpawnParticle(smoke2); }