diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 209be8de3b..58080aa750 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTime = Item.useAnimation = 39; Item.autoReuse = true; Item.useAmmo = AmmoID.Gel; - Item.shootSpeed = 14.6f; + Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.width = 84; diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 6e24712e04..41a452a74d 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -14,40 +14,39 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public ref int HitCount => ref Main.player[Projectile.owner].Calamity().deadSunCounter; - public int Time = 0; - public int bounceKill = 0; - public bool Homing = false; - public Color color1 = Color.Turquoise; - public Color color2 = Color.Indigo; + public ref float Time => ref Projectile.ai[0]; + public ref float BounceHits => ref Projectile.ai[1]; + + public Color InnerColor = Color.Turquoise; + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.extraUpdates = 9; - Projectile.timeLeft = 440; + Projectile.MaxUpdates = 10; + Projectile.timeLeft = 15 * Projectile.MaxUpdates; } public override void AI() { Time++; - Lighting.AddLight(Projectile.Center, 0.117f, 0.155f, 0.159f); + Lighting.AddLight(Projectile.Center, InnerColor.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 (Projectile.timeLeft % 3 == 0 && Time > 12 && targetDist < 1400f) + if (Projectile.timeLeft % 3 == 0 && Time > 12f && targetDist < 1400f) { AltSparkParticle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 20, 2.3f, Color.Black); GeneralParticleHandler.SpawnParticle(spark); } - if (Projectile.timeLeft % 2 == 0 && Time > 12 && targetDist < 1400f) + if (Projectile.timeLeft % 2 == 0 && Time > 12f && targetDist < 1400f) { - SparkParticle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 20, 0.9f, color1); + SparkParticle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 20, 0.9f, InnerColor); GeneralParticleHandler.SpawnParticle(spark2); } - if (Time == 7) + if (Time == 7f) { for (int i = 0; i <= 18; i++) { @@ -57,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; } } - if (Homing) + if (BounceHits > 0f) { for (int i = 0; i <= 2; i++) { @@ -73,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { SoundEngine.PlaySound(DeadSunsWind.Explosion with { Pitch = HitCount * 0.05f }, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 4f, Projectile.owner, HitCount * 10, Homing ? 5 : 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 4f, Projectile.owner, HitCount * 10, BounceHits > 0f ? 5 : 0); if (HitCount >= 15) HitCount = 6; else @@ -82,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.timeLeft = 440; + Projectile.timeLeft = 15 * Projectile.MaxUpdates; float numberOfDusts = 25; float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) @@ -96,15 +95,15 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity = dust.type == 191 ? velOffset * 2.5f : velOffset; dust.scale = dust.type == 191 ? Main.rand.NextFloat(0.9f, 1.9f) : Main.rand.NextFloat(2.6f, 3.2f); } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, color1, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0.1f, 0.9f - (bounceKill * 0.25f), 25); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, InnerColor, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0.1f, 0.9f - (BounceHits * 0.25f), 25); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.MediumSpringGreen, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0.05f, 0.75f - (bounceKill * 0.25f), 25); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.MediumSpringGreen, new Vector2(1f, 1f), Main.rand.NextFloat(5, -5), 0.05f, 0.75f - (BounceHits * 0.25f), 25); GeneralParticleHandler.SpawnParticle(pulse2); - Homing = true; - if (bounceKill == 0) + + if (BounceHits == 0f) SoundEngine.PlaySound(DeadSunsWind.Ricochet, Projectile.Center); - bounceKill++; + BounceHits++; if (Projectile.velocity.X != oldVelocity.X) { Projectile.velocity.X = -oldVelocity.X; @@ -113,7 +112,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.velocity.Y = -oldVelocity.Y; } - if (bounceKill == 4) + if (BounceHits >= 4f) Projectile.Kill(); return false; } diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 2180f1b43c..783d4fad52 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Projectiles.Ranged public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public int Time = 0; + public ref float Time => ref Projectile.ai[0]; + public override void SetDefaults() { Projectile.width = Projectile.height = 12; @@ -21,29 +22,28 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 5; - Projectile.extraUpdates = 10; - Projectile.timeLeft = 600; + Projectile.MaxUpdates = 10; + Projectile.timeLeft = 15 * Projectile.MaxUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + Projectile.rotation = Projectile.velocity.ToRotation(); Time++; - if (Projectile.scale <= 1.5f) - { - Projectile.scale *= 1.01f; - } - if (Time > 6 && Time < 180) + if (Time > 6f) { SparkParticle spark = new SparkParticle(Projectile.Center, Projectile.velocity, false, 11, 1.9f, Color.MediumBlue); GeneralParticleHandler.SpawnParticle(spark); SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity, false, 11, 1f, Color.Aqua); GeneralParticleHandler.SpawnParticle(spark2); } - if (Time == 5) + else if (Time == 5f) { - Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity * 0.75f, Color.Aqua, new Vector2(1f, 2.5f), Projectile.velocity.ToRotation(), 0.4f, 0.05f, 20); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity * 0.75f, Color.Aqua, new Vector2(1f, 2.5f), Projectile.rotation, 0.4f, 0.05f, 20); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Projectile.velocity * 0.4f, Color.DodgerBlue, new Vector2(1f, 2.5f), Projectile.velocity.ToRotation(), 0.2f, 0.05f, 35); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Projectile.velocity * 0.4f, Color.DodgerBlue, new Vector2(1f, 2.5f), Projectile.rotation, 0.2f, 0.05f, 35); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i <= 25; i++) { @@ -54,9 +54,7 @@ namespace CalamityMod.Projectiles.Ranged } } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.45f / 255f); - - Projectile.rotation += 0.3f * (float)Projectile.direction; + Lighting.AddLight(Projectile.Center, Color.MediumBlue.ToVector3() * 0.4f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/TerraFire.cs b/Projectiles/Ranged/TerraFire.cs index 1b2e083801..3e8c266019 100644 --- a/Projectiles/Ranged/TerraFire.cs +++ b/Projectiles/Ranged/TerraFire.cs @@ -46,10 +46,10 @@ namespace CalamityMod.Projectiles.Ranged Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, smokeColor, 12, Projectile.scale * Main.rand.NextFloat(0.6f, 1.2f), 0.3f, smokeRot, true, required: true); GeneralParticleHandler.SpawnParticle(smoke); - // Overlay the glow on top, shifted toward yellow + // Overlay a gold glow on top if (Main.rand.NextBool(5)) { - Color glowColor = Color.Lerp(smokeColor, Color.Yellow, 0.5f); + Color glowColor = Color.Gold; Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * 0.5f, glowColor, 9, Projectile.scale * Main.rand.NextFloat(0.4f, 0.7f), 0.2f, smokeRot, true, 0.005f); GeneralParticleHandler.SpawnParticle(smokeGlow); } diff --git a/Projectiles/Ranged/TerraFlare.cs b/Projectiles/Ranged/TerraFlare.cs index 358019bbc5..ac151cb371 100644 --- a/Projectiles/Ranged/TerraFlare.cs +++ b/Projectiles/Ranged/TerraFlare.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged Color color = Color.Lerp(Color.Lime, Color.Cyan, colorInterpolation); Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-15f, -15f); Color outerColor = color; - Color innerColor = Color.Lerp(color, Color.Yellow, 0.3f) * 0.5f; + Color innerColor = Color.Lerp(color, Color.Gold, 0.8f) * 0.5f; float intensity = 0.9f + 0.15f * MathF.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); // Become smaller the futher along the old positions we are.