diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs new file mode 100644 index 0000000000..33568b1b9f --- /dev/null +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -0,0 +1,70 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AquashardShotgun : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.width = 62; + Item.height = 26; + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = SoundID.Item61; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.useAmmo = AmmoID.Bullet; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + int projAmt = Main.rand.Next(2, 4); + for (int index = 0; index < projAmt; ++index) + { + float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; + + if (type == ProjectileID.Bullet) + { + int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Main.projectile[projectile].timeLeft = 200; + } + else + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Boomstick). + AddIngredient(2). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/AquashardShotgun.png b/Items/Weapons/Ranged/AquashardShotgun.png new file mode 100644 index 0000000000..516b1fa7cc Binary files /dev/null and b/Items/Weapons/Ranged/AquashardShotgun.png differ diff --git a/Items/Weapons/Ranged/Shardshocker.cs b/Items/Weapons/Ranged/Shardshocker.cs deleted file mode 100644 index 1223124a57..0000000000 --- a/Items/Weapons/Ranged/Shardshocker.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class Shardshocker : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - public override void SetDefaults() - { - Item.width = 86; - Item.height = 44; - Item.damage = 131; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 60; - Item.useAnimation = 60; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = null; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 50f; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); - SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); - Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); - return false; - } - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(4, 1); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); - } - - // Recoil + Not having the gun aim downwards - public override void UseItemFrame(Player player) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - - float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; - float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.5) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - - - //Reloads the gun - if (animProgress > 0.5f) - { - float backArmRotation = rotation + 0.52f * player.direction; - - Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); - player.SetCompositeArmBack(true, stretch, backArmRotation); - } - - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(5). - AddIngredient(15). - AddIngredient(2). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/Shardshocker.png b/Items/Weapons/Ranged/Shardshocker.png deleted file mode 100644 index dc5fde0017..0000000000 Binary files a/Items/Weapons/Ranged/Shardshocker.png and /dev/null differ diff --git a/Items/Weapons/Ranged/TheBlunderbass.cs b/Items/Weapons/Ranged/TheBlunderbass.cs deleted file mode 100644 index d29689df96..0000000000 --- a/Items/Weapons/Ranged/TheBlunderbass.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.FurnitureDriftwood; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - [LegacyName("AquashardShotgun")] - public class TheBlunderbass : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; - public override void SetDefaults() - { - Item.width = 56; - Item.height = 26; - Item.damage = 35; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 55; - Item.useAnimation = 55; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = null; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); - SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); - Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); - return false; - } - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; - Vector2 itemSize = new Vector2(Item.width, Item.height); - Vector2 itemOrigin = new Vector2(4, 1); - - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); - base.UseStyle(player, heldItemFrame); - } - - // Recoil + Not having the gun aim downwards - public override void UseItemFrame(Player player) - { - player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); - - float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; - float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.5) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; - player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate - - - //Reloads the gun - if (animProgress > 0.5f) - { - float backArmRotation = rotation + 0.52f * player.direction; - - Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); - player.SetCompositeArmBack(true, stretch, backArmRotation); - } - - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(15). - AddIngredient(3). - AddIngredient(7). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/TheBlunderbass.png b/Items/Weapons/Ranged/TheBlunderbass.png deleted file mode 100644 index 255af4609d..0000000000 Binary files a/Items/Weapons/Ranged/TheBlunderbass.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 905840cb08..95aa400f41 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -75,6 +75,11 @@ Arbalest: { ''' } +AquashardShotgun: { + DisplayName: Aquashard Shotgun + Tooltip: Converts musket balls into aquashards that split upon hitting an enemy +} + Archerfish: { DisplayName: Archerfish Tooltip: @@ -1104,18 +1109,6 @@ Shadethrower: { ''' } -Shardshocker: { - DisplayName: Shardshocker - Tooltip: - ''' - Fires an electrically charged crystal that travels a short distance before stopping - The crystal will hang in the air and occasionally give off damaging pulses of electricity - Hitting a stopped crystal with a moving one will detonate both in a massive explosion that lets off homing shards - Direct hits with the crystal will create a smaller explosion and stun enemies - 'Plasmaaaaaa!' - ''' -} - Shellshooter: { DisplayName: Shellshooter Tooltip: @@ -1338,15 +1331,6 @@ TheBallista: { Tooltip: Converts wooden arrows into greatarrows that crush enemy armor and break into shards } -TheBlunderbass: { - DisplayName: The Blunderbass - Tooltip: - ''' - Fires a large crystal that travels a short distance before bursting into homing shards - Direct hits with the crystal stun enemies and increase the amount of shards created - ''' -} - TheHive: { DisplayName: The Hive Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 200dfc4787..27cc5aaaef 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -6,7 +6,7 @@ AngelicBeam.DisplayName: Angelic Beam AnimosityBullet.DisplayName: Brimstone Round AquaBlast.DisplayName: Aqua Blast AquaBlastToxic.DisplayName: Aqua Blast Toxic -Aquashard.DisplayName: Aqua Crystal +Aquashard.DisplayName: Aquashard AquashardSplit.DisplayName: Aquashard ArcherfishRing.DisplayName: Archerfish Ring ArcherfishShot.DisplayName: Water Round @@ -202,7 +202,6 @@ SevensStrikerGrape.DisplayName: Grapes SevensStrikerOrange.DisplayName: Orange SevensStrikerPlatinumCoin.DisplayName: Platinum Coin ShadeFire.DisplayName: Shady Fire -ShardshockerCrystal.DisplayName: Charged Aqua Crystal Shell.DisplayName: Shell Shockblast.DisplayName: Blast ShockblastRound.DisplayName: Round diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 0e33af218e..174f3c17d0 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -1,140 +1,52 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using CalamityMod.Particles; -using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.GameContent.Animations.Actions.Sprites; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Projectiles.Summon; namespace CalamityMod.Projectiles.Ranged { public class Aquashard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public int time = 0; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 10; + Projectile.height = 10; Projectile.friendly = true; - Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 300; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.extraUpdates = 1; } public override void AI() { - //Rotation - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (time == 1) - { - Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; - int smokeAmount = Main.rand.Next(8, 12 + 1); - for (int i = 0; i < smokeAmount; i++) - { - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); - GeneralParticleHandler.SpawnParticle(smoke); - - } - for (int i = 0; i < 5; i++) - { - Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); - GeneralParticleHandler.SpawnParticle(spark); - } - } - if (time >= 2) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); - dust.scale = Main.rand.NextFloat(0.6f, 0.8f); - dust.noGravity = false; - } - if (time == 14) - { - Projectile.Kill(); - } - time++; + Projectile.velocity.X *= 0.9995f; + Projectile.velocity.Y += 0.01f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int projAmt = 3; - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 0f, Projectile.owner); - } - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f;; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.DarkTurquoise, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - Player Owner = Main.player[Projectile.owner]; - if (Owner.Calamity().GeneralScreenShakePower < 1.2f) - Owner.Calamity().GeneralScreenShakePower = 1.2f; - target.AddBuff(ModContent.BuffType(), 30); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); - int projAmt = 3; + int projAmt = Main.rand.Next(1, 3); if (Projectile.owner == Main.myPlayer) { for (int i = 0; i < projAmt; i++) { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Projectile.owner); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner); } } - // Create Blast - float blastSize = 80; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - blast.ArmorPenetration = 5; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.08f, 22); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.06f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing3); - for (int i = 0; i < (int)(15); i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); - dust.noGravity = !Main.rand.NextBool(); - dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; - } - } - public override bool PreDraw(ref Color lightColor) - { - if (time < 2) - { - return false; - } - return base.PreDraw(ref lightColor); } } } diff --git a/Projectiles/Ranged/Aquashard.png b/Projectiles/Ranged/Aquashard.png index 54457ff6b4..0e32025173 100644 Binary files a/Projectiles/Ranged/Aquashard.png and b/Projectiles/Ranged/Aquashard.png differ diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index 82ce78b9f9..a9555374d0 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -2,15 +2,13 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Ranged { public class AquashardSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() @@ -38,16 +36,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.Center); - Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.SkyBlue, Color.DarkTurquoise, Main.rand.NextFloat(1f, 1.1f), 30, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - int num190 = Main.rand.Next(5, 9); - for (int i = 0; i < num190; i++) + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + for (int k = 0; k < 5; k++) { - int bubbly = Dust.NewDust(Projectile.Center, 0, 0, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.4f); - Main.dust[bubbly].velocity *= 0.8f; - Main.dust[bubbly].position = Vector2.Lerp(Main.dust[bubbly].position, Projectile.Center, 0.5f); - Main.dust[bubbly].noGravity = true; + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } } diff --git a/Projectiles/Ranged/ShardshockerCrystal.cs b/Projectiles/Ranged/ShardshockerCrystal.cs deleted file mode 100644 index 75ceacb4f8..0000000000 --- a/Projectiles/Ranged/ShardshockerCrystal.cs +++ /dev/null @@ -1,259 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using CalamityMod.Particles; -using CalamityMod.Tiles.Abyss; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.GameContent.Animations.Actions.Sprites; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework.Graphics; -using Terraria.GameContent; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Melee; -using System; -using System.Data; -using CalamityMod.Items.Ammo; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ShardshockerCrystal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; - public static readonly SoundStyle Collision = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact") { Volume = 0.5f }; - public int time = 0; - - public override void SetDefaults() - { - Projectile.width = 33; - Projectile.height = 33; - Projectile.friendly = true; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; - Projectile.timeLeft = 240; - } - - //The crystal can only damage enemies if it's not hanging in the air - public override bool? CanDamage() => time <= 30 ? null : false; - public override void AI() - { - //Set the projectile as traveling and only update rotation while traveling - if (time < 30) - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.ai[1] = 1f; - } - - // Make it lose velocity as it travels - Projectile.velocity *= 0.94f; - #region Traveling Visuals - //Firing effects on frame one - if (time == 1) - { - Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; - int smokeAmount = Main.rand.Next(8, 12 + 1); - for (int i = 0; i < smokeAmount; i++) - { - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); - GeneralParticleHandler.SpawnParticle(smoke); - - } - for (int i = 0; i < 5; i++) - { - Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); - GeneralParticleHandler.SpawnParticle(spark); - } - } - //Only spawn dust trails while traveling - if (time >= 2 && time <= 30) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); - dust.scale = Main.rand.NextFloat(0.6f, 0.8f); - dust.noGravity = false; - } - #endregion - //After traveling for 30 frames, come to a stop in the air - if (time >= 30) - { - //Set AI as stopped so traveling crystals can collide with it - Projectile.ai[1] = 0f; - Projectile.velocity = Vector2.Zero; - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); - spark.noGravity = true; - spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.LightSkyBlue; - if (Main.rand.NextBool(13)) - { - // Create a lightning bolt-like particle in the direction of the shot and 3 random hue-shifted ones by the side - Particle bolt = new CrackParticle(Projectile.Center, velocity * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.5f), 12); - GeneralParticleHandler.SpawnParticle(bolt); - - for (int i = 1; i < 4; i++) - { - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.2f, 0.3f), 12); - GeneralParticleHandler.SpawnParticle(bolt2); - } - } - //Create a lightning AoE every second - if (time % 60 == 0) - { - SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); - // Create Blast - float blastSize = 120; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 30); - GeneralParticleHandler.SpawnParticle(blastRing3); - } - //Set up colliding behavior - foreach (Projectile proj in Main.ActiveProjectiles) - { - // Only allow other large crystals to collide - if (proj.type != Type) - continue; - - // Check if the colliding crystal is traveling - if (proj.ai[1] > 0f && Projectile.Hitbox.Intersects(proj.Hitbox)) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); - //Set on kill effects and kill the stopped crystal - Projectile.ai[1] = 2f; - Projectile.Kill(); - //Kill the traveling crystal - proj.timeLeft = 0; - } - } - } - time++; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // Create a smaller AoE on direct hits - float blastSize = 130; - float minMultiplier = 0.25f; - int hitsToMinMult = 4; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.DamageType = DamageClass.Ranged; - - target.AddBuff(ModContent.BuffType(), 60); - - #region Visuals and Sound - SoundEngine.PlaySound(Collision, Projectile.Center); - - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.1f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.18f, 22, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 22); - GeneralParticleHandler.SpawnParticle(blastRing3); - - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.MediumAquamarine, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - - for (int i = 1; i < 8; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(9f, 11f)); - Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); - spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.SkyBlue; - } - - for (int i = 1; i < 6; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.8f, 1.1f), 17); - GeneralParticleHandler.SpawnParticle(bolt2); - } - #endregion - } - - public override void OnKill(int timeLeft) - { - //These effects only occur if another crystal collides with a stopped one - if (Projectile.ai[1] == 2f) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); - Player Owner = Main.player[Projectile.owner]; - if (Owner.Calamity().GeneralScreenShakePower < 1.2f) - Owner.Calamity().GeneralScreenShakePower = 1.2f; - int projAmt = 15; - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 0f, Projectile.owner); - } - float blastSize = 185; - float minMultiplier = 0.25f; - int hitsToMinMult = 8; - int debuff1 = BuffID.Electrified; - int debuffTime = 240; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); - blast.localAI[0] = debuff1; - blast.localAI[1] = debuffTime; - blast.DamageType = DamageClass.Ranged; - for (int i = 1; i < 9; i++) - { - Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); - Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.9f, 1.5f), 20); - GeneralParticleHandler.SpawnParticle(bolt2); - } - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.25f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.16f, 25, true); - GeneralParticleHandler.SpawnParticle(blastRing3); - float offset = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 4; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; - Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 2.5f, Color.MediumAquamarine, true); - GeneralParticleHandler.SpawnParticle(cross); - } - for (int k = 0; k < 3; k++) - { - Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); - GeneralParticleHandler.SpawnParticle(outerGlow); - Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); - GeneralParticleHandler.SpawnParticle(innerGlow); - } - } - //These effects always occur - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); - for (int i = 0; i < (int)(15); i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); - dust.noGravity = !Main.rand.NextBool(); - dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; - } - } - public override bool PreDraw(ref Color lightColor) - { - //Don't draw the projectile for the first two frames, to prevent it from coming out of the player - if (time < 2) - { - return false; - } - return base.PreDraw(ref lightColor); - } - } -}