From 82c9c2e7cdeb0b7fc23e7caea0faca2dbae42f65 Mon Sep 17 00:00:00 2001 From: Xyk Date: Sat, 13 Apr 2024 22:47:56 -0700 Subject: [PATCH 1/2] Void Vortex p1 --- Items/Weapons/Magic/VoidVortex.cs | 19 ++-- Projectiles/Magic/ClimaxBeam.cs | 44 +++++++- Projectiles/Magic/VoidVortexProj.cs | 163 ++++++++++++++++++++++++---- 3 files changed, 196 insertions(+), 30 deletions(-) diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index be59e1e2b0..681f322275 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 130; Item.height = 130; - Item.damage = 110; + Item.damage = 90; Item.DamageType = DamageClass.Magic; - Item.mana = 60; - Item.useTime = 80; - Item.useAnimation = 80; + Item.mana = 30; + Item.useTime = 43; + Item.useAnimation = 43; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; @@ -44,21 +44,22 @@ namespace CalamityMod.Items.Weapons.Magic { int numOrbs = 12; Vector2 clickPos = Main.MouseWorld; - float orbDistance = 48f; - float orbSpeed = 5f; + float orbDistance = 90f; + float orbSpeed = 4f; float spinCoinflip = Main.rand.NextBool() ? -1f : 1f; Vector2 dir = Main.rand.NextVector2Unit(); for (int i = 0; i < numOrbs; i++) { Vector2 orbPos = clickPos + dir * orbDistance; - Vector2 vel = dir.RotatedBy(spinCoinflip * MathHelper.PiOver2) * orbSpeed; + Vector2 vel = dir.RotatedBy(spinCoinflip * -MathHelper.PiOver2) * orbSpeed; // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers - float timingStagger = Main.rand.Next(OrbFireRate); - Projectile.NewProjectile(source, orbPos, vel, type, damage, knockback, player.whoAmI, timingStagger, spinCoinflip); + Projectile.NewProjectile(source, orbPos, -vel, type, damage, knockback, player.whoAmI, i * 4, spinCoinflip); dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs); } + // Big orb + Projectile.NewProjectile(source, clickPos, Vector2.Zero, type, damage * 9, 10, player.whoAmI, 0, spinCoinflip, 1); return false; } diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 75e59aa5bb..c3b1730d62 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Magic { @@ -9,14 +10,21 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float dustAngle = 0f; + public bool growing = false; + public bool dustWave = false; + public float variance; public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.extraUpdates = 100; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.friendly = true; - Projectile.timeLeft = 90; + Projectile.timeLeft = 500; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -24,12 +32,46 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + /* Vector2 projPos = Projectile.position; projPos -= Projectile.velocity * 0.25f; int boltDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.25f); Main.dust[boltDust].position = projPos; Main.dust[boltDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[boltDust].velocity *= 0.1f; + */ + + if (Projectile.timeLeft == 500) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.13f, 0.13f, 3); + GeneralParticleHandler.SpawnParticle(orb2); + } + + if (Projectile.timeLeft % 3 == 0 && Projectile.timeLeft < 499) + { + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.8f, Color.Aqua * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + LineParticle spark3 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.3f, Color.White * 0.6f); + GeneralParticleHandler.SpawnParticle(spark3); + } + + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 226, Projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.noGravity = true; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 90); + if (hit.Damage > 1) + Projectile.Kill(); } } } diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index 5c55d63178..27aa396556 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -1,7 +1,13 @@ -using CalamityMod.Items.Weapons.Magic; +using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil; using Terraria; +using Terraria.Audio; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -9,9 +15,16 @@ namespace CalamityMod.Projectiles.Magic public class VoidVortexProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public int time = 0; + public int timeOffset = 0; + public bool doDamage = false; + public bool fireBeam = true; + public bool rotDirection = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -22,21 +35,94 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 135; + Projectile.timeLeft = 90; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Magic; } public override void AI() { - // Spin chaotically given a pre-defined spin direction. Choose one initially at random. - float spinTheta = 0.11f; - if (Projectile.localAI[0] == 0f) - Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[0]; + if (Projectile.ai[2] == 3) + { + if (time == 0) + { + timeOffset = Main.rand.Next(20, 40 + 1); + Projectile.timeLeft = 500; + Projectile.extraUpdates = 2; + Projectile.scale = Main.rand.NextFloat(0.35f, 0.55f); + rotDirection = Main.rand.NextBool(); + } + + if (time >= 20) + doDamage = true; + if (time >= timeOffset && time % 25 == 0) + { + Projectile.velocity = Projectile.velocity.RotatedBy(rotDirection ? 0.65f : -0.65f); + rotDirection = !rotDirection; + } + CalamityUtils.HomeInOnNPC(Projectile, true, 1000f, 15, MathHelper.Clamp(100f - time * 0.3f, 40, 100)); + if (Main.rand.NextBool()) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f)); + dust2.scale = Main.rand.NextFloat(0.35f, 0.75f); + dust2.noGravity = true; + } + + } + else + { + if (Projectile.timeLeft < 65) + { + Projectile.velocity *= 0.98f; + } + else + { + // Spin chaotically given a pre-defined spin direction. Choose one initially at random. + float spinTheta = 0.11f; + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; + //Projectile.rotation += Projectile.localAI[0]; + + // Spiral outwards in an increasingly chaotic fashion. + float revolutionTheta = 0.14f * Projectile.ai[1]; + if (Projectile.ai[0] % 2 == 0f) + Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + + } + if (time == 25 && Projectile.ai[2] == 1) + { + Projectile.scale = 1.5f; + Projectile.alpha = 0; + for (int k = 0; k < 25; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.95f); + dust2.noGravity = true; + } + Projectile.ai[0] = 0; + } + if (time >= 25 && Projectile.ai[2] == 1 && time % 2 == 0 && Projectile.timeLeft > 20) + { + Particle bolt = new CrackParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100), Color.Aqua * 0.65f, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.65f), 11); + GeneralParticleHandler.SpawnParticle(bolt); + } + + --Projectile.ai[0]; + + NPC target = Projectile.Center.ClosestNPCAt(1000); + + if (fireBeam && Projectile.ai[0] == -30 && Projectile.ai[2] <= 0 && target != null) + { + CalamityUtils.MagnetSphereHitscan(Projectile, 1000f, 8f, 0, 2, ModContent.ProjectileType(), 1D, true); + fireBeam = false; + } + } // Animate the lightning orb. Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 3) { Projectile.frameCounter = 0; Projectile.frame++; @@ -46,24 +132,58 @@ namespace CalamityMod.Projectiles.Magic } } - // Spiral outwards in an increasingly chaotic fashion. - float revolutionTheta = 0.12f * Projectile.ai[1]; - Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f; + if (Projectile.ai[0] <= 0) + time++; + } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[2] == 1) + { + doDamage = true; + Projectile.ExpandHitboxBy(400); + Projectile.Damage(); - // Initial stagger in frames needs to be skipped over before it starts shooting, - // but once it's past that then it can fire constantly - --Projectile.ai[0]; - if (Projectile.ai[0] < 0f) - CalamityUtils.MagnetSphereHitscan(Projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + for (int k = 0; k < 12; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 8, 0f, Main.myPlayer, 0f, 0f, 3f); + } + for (int k = 0; k < 40; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.65f, 1.15f); + dust2.noGravity = true; + } + SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0f }, Projectile.Center); + Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0, 0.2f, 14); + GeneralParticleHandler.SpawnParticle(bolt); + } + if (Projectile.ai[2] == 3) + { + for (int k = 0; k < 7; k++) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.75f); + dust2.noGravity = true; + } + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Electrified, 180); + if (hit.Damage > 1 && Projectile.ai[2] == 3) + Projectile.Kill(); } public override Color? GetAlpha(Color lightColor) { - if (Projectile.timeLeft < 30) + if (Projectile.timeLeft < 20) { - float timerAlpha = Projectile.timeLeft / 30f; + float timerAlpha = Projectile.timeLeft / 20f; Projectile.alpha = (int)(255f - 255f * timerAlpha); } + if (time < 25 && Projectile.ai[2] == 1) + Projectile.alpha = 255; return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } @@ -72,10 +192,13 @@ namespace CalamityMod.Projectiles.Magic Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale * (Projectile.ai[2] == 3 ? 1.3f : 1f), SpriteEffects.None, 0); + + if (Projectile.ai[2] == 3) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.3f, 1, texture2D13); return false; } - public override bool? CanDamage() => false; + public override bool? CanDamage() => doDamage ? null : false; } } From adc750320d99acdd1244bec2adb2c79e41b92b56 Mon Sep 17 00:00:00 2001 From: Xyk Date: Sat, 4 May 2024 00:40:57 -0700 Subject: [PATCH 2/2] Completed Weapons --- Items/Weapons/Magic/MagneticMeltdown.cs | 12 +++--- Items/Weapons/Magic/VoidVortex.cs | 12 +++--- Items/Weapons/Magic/VoltaicClimax.cs | 16 ++++---- ...Mods.CalamityMod.Items.Weapons.Magic.hjson | 4 +- Projectiles/Magic/ClimaxBeam.cs | 8 +--- Projectiles/Magic/ClimaxProj.cs | 18 +++++++-- Projectiles/Magic/MagneticBeam.cs | 37 ++++++++++++++----- Projectiles/Magic/MagneticOrb.cs | 12 ++++-- Projectiles/Magic/VoidVortexProj.cs | 6 +-- 9 files changed, 75 insertions(+), 50 deletions(-) diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 7bcdf3b1ba..1deeb30374 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -21,18 +21,18 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 78; Item.height = 78; - Item.damage = 100; + Item.damage = 245; Item.DamageType = DamageClass.Magic; - Item.mana = 40; - Item.useTime = 49; - Item.useAnimation = 49; + Item.mana = 32; + Item.useTime = 37; + Item.useAnimation = 37; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 18f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.SpectreStaff). AddIngredient(ItemID.MagnetSphere). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index 681f322275..bac7097207 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Magic public class VoidVortex : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public const int OrbFireRate = 15; public override void SetStaticDefaults() { @@ -24,11 +23,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 130; Item.height = 130; - Item.damage = 90; + Item.damage = 225; Item.DamageType = DamageClass.Magic; - Item.mana = 30; - Item.useTime = 43; - Item.useAnimation = 43; + Item.mana = 60; + Item.useTime = 49; + Item.useAnimation = 49; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0f; @@ -54,12 +53,11 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 orbPos = clickPos + dir * orbDistance; Vector2 vel = dir.RotatedBy(spinCoinflip * -MathHelper.PiOver2) * orbSpeed; - // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers Projectile.NewProjectile(source, orbPos, -vel, type, damage, knockback, player.whoAmI, i * 4, spinCoinflip); dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs); } // Big orb - Projectile.NewProjectile(source, clickPos, Vector2.Zero, type, damage * 9, 10, player.whoAmI, 0, spinCoinflip, 1); + Projectile.NewProjectile(source, clickPos, Vector2.Zero, type, damage * 4, 10, player.whoAmI, 0, spinCoinflip, 1); return false; } diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index d1b5c9c448..a2bd468659 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Items.Weapons.Magic public class VoltaicClimax : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public const int OrbFireRate = 10; public override void SetStaticDefaults() { @@ -25,11 +24,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 78; Item.height = 78; - Item.damage = 104; + Item.damage = 235; Item.DamageType = DamageClass.Magic; - Item.mana = 30; - Item.useTime = 33; - Item.useAnimation = 33; + Item.mana = 32; + Item.useTime = 29; + Item.useAnimation = 29; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -43,15 +42,14 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int numOrbs = 8; + int numOrbs = 9; Vector2 clickPos = Main.MouseWorld; float orbSpeed = 14f; Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed); for (int i = 0; i < numOrbs; i++) { - // Choose random firing stagger values for each orb to create a desynchronized barrage of lasers - float timingStagger = Main.rand.Next(OrbFireRate); - Projectile.NewProjectile(source, clickPos, vel, type, damage, knockback, player.whoAmI, ai0: timingStagger); + float timingStagger = i * 2; + Projectile.NewProjectile(source, clickPos, vel, type, damage, knockback, player.whoAmI, timingStagger); vel = vel.RotatedBy(MathHelper.TwoPi / numOrbs); } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 13d5acad25..f857698016 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -924,12 +924,12 @@ VividClarity: { VoidVortex: { DisplayName: Void Vortex - Tooltip: Conjures a swirling vortex of supercharged magnet spheres around the cursor + Tooltip: Conjures a swirling vortex of supercharged magnet spheres around the cursor that explodes into a storm of homing mini spheres } VoltaicClimax: { DisplayName: Voltaic Climax - Tooltip: Conjures an octagon of supercharged magnet spheres around the cursor + Tooltip: Conjures a ring of supercharged magnet spheres around the cursor } Waywasher: { diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index c3b1730d62..8cd668dbf0 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -10,16 +10,12 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public float dustAngle = 0f; - public bool growing = false; - public bool dustWave = false; - public float variance; public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; - Projectile.extraUpdates = 100; + Projectile.extraUpdates = 70; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -62,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i <= 4; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 226, Projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 226, (Projectile.velocity * 2) * Main.rand.NextFloat(0.1f, 0.9f)); dust.scale = Main.rand.NextFloat(0.3f, 0.5f); dust.noGravity = true; } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index a5593ce023..8ff285b156 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,6 +10,7 @@ namespace CalamityMod.Projectiles.Magic public class ClimaxProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public bool firedBeam = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -28,6 +30,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + if (Projectile.timeLeft == 48) + Projectile.frame = Main.rand.Next(0, 4 + 1); + // Rapidly screech to a halt once spawned. Projectile.velocity *= 0.86f; @@ -35,11 +40,10 @@ namespace CalamityMod.Projectiles.Magic float spinTheta = 0.11f; if (Projectile.localAI[0] == 0f) Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[0]; // Animate the lightning orb. Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 3) { Projectile.frameCounter = 0; Projectile.frame++; @@ -51,9 +55,15 @@ namespace CalamityMod.Projectiles.Magic // Initial stagger in frames needs to be skipped over before it starts shooting, // but once it's past that then it can fire constantly + + NPC target = Projectile.Center.ClosestNPCAt(800); + --Projectile.ai[0]; - if (Projectile.ai[0] < 0f) - CalamityUtils.MagnetSphereHitscan(Projectile, 640f, 8f, VoltaicClimax.OrbFireRate, 2, ModContent.ProjectileType(), 1D, true); + if (Projectile.ai[0] < 0f && firedBeam == false && target != null) + { + firedBeam = true; + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 5, ModContent.ProjectileType(), 1D, false); + } } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 61671a9e74..0b46e5390d 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,21 +15,39 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 4; Projectile.height = 4; - Projectile.extraUpdates = 100; + Projectile.extraUpdates = 70; Projectile.friendly = true; - Projectile.timeLeft = 90; + Projectile.timeLeft = 500; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; } public override void AI() { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * 0.25f; - int dust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1.25f); - Main.dust[dust].position = projPos; - Main.dust[dust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[dust].velocity *= 0.1f; + if (Projectile.timeLeft == 500) + { + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkOrchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.13f, 0.13f, 3); + GeneralParticleHandler.SpawnParticle(orb2); + } + + if (Projectile.timeLeft % 3 == 0 && Projectile.timeLeft < 499) + { + LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.4f, Color.DarkOrchid * 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); + LineParticle spark3 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1f, Color.White * 0.6f); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 272, (Projectile.velocity * 3) * Main.rand.NextFloat(0.1f, 0.9f)); + dust.scale = Main.rand.NextFloat(0.3f, 0.5f); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 97f9f97089..8a6e384e68 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.timeLeft = 50; Projectile.DamageType = DamageClass.Magic; } @@ -34,7 +34,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Drift to a stop after being launched - Projectile.velocity *= 0.972f; + if (Projectile.timeLeft < 40) + Projectile.velocity *= 0.882f; // On frame 1, pick a random offset to use for the firing pattern. if (Projectile.timeLeft == Lifetime) @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic // Update animation Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (Projectile.frameCounter > 4) { Projectile.frameCounter = 0; Projectile.frame++; @@ -62,7 +63,10 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 8f, FramesPerBeam, 1, ModContent.ProjectileType(), 1D, true); + NPC target = Projectile.Center.ClosestNPCAt(550); + + if ((Projectile.timeLeft == 30 || Projectile.timeLeft == 10) && target != null) + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 1, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index 27aa396556..f8c424ab86 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Magic if (fireBeam && Projectile.ai[0] == -30 && Projectile.ai[2] <= 0 && target != null) { - CalamityUtils.MagnetSphereHitscan(Projectile, 1000f, 8f, 0, 2, ModContent.ProjectileType(), 1D, true); + CalamityUtils.MagnetSphereHitscan(Projectile, Vector2.Distance(Projectile.Center, target.Center), 8f, 0, 1, ModContent.ProjectileType(), 1D, true); fireBeam = false; } } @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Magic for (int k = 0; k < 12; k++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 8, 0f, Main.myPlayer, 0f, 0f, 3f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); } for (int k = 0; k < 40; k++) { @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Magic } SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0f }, Projectile.Center); - Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0, 0.2f, 14); + Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.03f, 0.16f, 16); GeneralParticleHandler.SpawnParticle(bolt); } if (Projectile.ai[2] == 3)