diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 563185668f..9282f1dd58 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; @@ -334,6 +335,156 @@ namespace CalamityMod.CalPlayer GungeonMusicSystem.GUN(); } + if (cgp.fireBullet) + { + target.AddBuff(BuffID.OnFire3, 60); + for (int i = 0; i < 3; i++) + { + CritSpark spark = new CritSpark(proj.Center, proj.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.5f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, Color.Yellow, Main.rand.NextFloat(0.4f, 0.6f), 15, Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.3f, Pitch = 0.8f }, proj.Center); + } + + if (cgp.iceBullet) + { + target.AddBuff(BuffID.Frostburn2, 60); + for (int i = 0; i < 3; i++) + { + CritSpark spark = new CritSpark(proj.Center, proj.velocity.RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.5f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.LightSkyBlue, Color.White, Main.rand.NextFloat(0.4f, 0.6f), 15, Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.3f, Pitch = 0.8f }, proj.Center); + } + + if (cgp.shockBullet) + { + target.AddBuff(BuffID.Electrified, 180); + + CustomPulse spark = new CustomPulse(proj.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/PlasmaExplosion", new Vector2(1, 1), Main.rand.NextFloat(-2f, 2f), 0.005f, Main.rand.NextFloat(0.048f, 0.055f), 14); + GeneralParticleHandler.SpawnParticle(spark); + int points = 6; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + SparkParticle subTrail = new SparkParticle(proj.Center + velocity * 4.5f, velocity * 8, false, 13, 0.85f, Color.Turquoise); + GeneralParticleHandler.SpawnParticle(subTrail); + } + for (int i = 0; i <= 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(proj.Center, 278, new Vector2(4, 4).RotatedByRandom(100f) * Main.rand.NextFloat(0.1f, 2.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.3f, 0.9f); + dust2.color = Color.Turquoise; + } + + int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); + Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + + if (proj.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/ElectricHit"); + SoundEngine.PlaySound(hitSound with { Volume = 0.2f, Pitch = 0.7f, PitchVariance = 0.2f }, proj.Center); + } + } + + if (cgp.pearlBullet) + { + Vector2 randPos = proj.Center + new Vector2(30, 30).RotateRandom(100) * Main.rand.NextFloat(0.9f, 1.1f); + CustomPulse spark = new CustomPulse(randPos, Vector2.Zero, Color.White, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1, 1), Main.rand.NextFloat(-2f, 2f), 0.005f, 0.08f, 14); + GeneralParticleHandler.SpawnParticle(spark); + int points = (int)(MathHelper.Clamp(6 - (int)(proj.numHits * 0.3f), 3, 6)); + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + float rotRando = Main.rand.NextFloat(0.1f, 2.5f); + for (int k = 0; k < points; k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando); + SparkParticle subTrail = new SparkParticle(randPos + velocity * 10f, velocity * 15, false, 13, 1f, color); + GeneralParticleHandler.SpawnParticle(subTrail); + SparkParticle subTrail2 = new SparkParticle(randPos + velocity * 20f, velocity * 18, false, 23, 0.55f, Color.White); + GeneralParticleHandler.SpawnParticle(subTrail2); + } + + int pearls = (int)(MathHelper.Clamp(7 - (int)(proj.numHits * 0.5f), 2, 7)); + for (int k = 0; k < pearls; k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + Vector2 velocity = new Vector2(1, 1).RotatedByRandom(100) * Main.rand.NextFloat(0.7f, 1.2f); + PearlParticle subTrail = new PearlParticle(randPos + velocity * 11f, velocity * 10, true, 50, 0.85f, color, 0.95f, Main.rand.NextFloat(2, -2), true); + GeneralParticleHandler.SpawnParticle(subTrail); + } + int dusts = (int)(MathHelper.Clamp(10 - (int)(proj.numHits * 0.5f), 2, 10)); + for (int i = 0; i <= dusts; i++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + Dust dust2 = Dust.NewDustPerfect(randPos, 278, new Vector2(5, 5).RotatedByRandom(100f) * Main.rand.NextFloat(0.1f, 2.9f)); + dust2.noGravity = false; + dust2.scale = Main.rand.NextFloat(0.3f, 0.8f); + dust2.color = color; + } + + int onHitDamage = Player.CalcIntDamage(0.2f * proj.damage); + Player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); + + if (proj.numHits == 0) + { + SoundStyle hitSound = new("CalamityMod/Sounds/Item/HadalUrnClose"); + SoundEngine.PlaySound(hitSound with { Volume = 0.4f, Pitch = 0.4f, PitchVariance = 0.2f }, proj.Center); + } + + } + + if (cgp.lifeBullet) + { + int points = 10; + for (int k = 0; k < points; k++) + { + Vector2 velocity = proj.velocity.RotatedByRandom(0.7f) * Main.rand.NextFloat(0.3f, 0.8f); + LineParticle orb = new LineParticle(proj.Center + velocity * 1.5f, velocity * Main.rand.NextFloat(1f, 2f), false, 18, Main.rand.NextFloat(0.4f, 0.7f), Color.White * 0.85f); + GeneralParticleHandler.SpawnParticle(orb); + } + + int heal = (int)Math.Round(hit.Damage * 0.035); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + + if (cgp.lifeBullet2) + { + int points = 12; + for (int k = 0; k < points; k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + + Vector2 velocity = proj.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 0.8f); + LineParticle orb = new LineParticle(proj.Center + velocity * 1.5f, velocity * Main.rand.NextFloat(1f, 3f), false, 18, Main.rand.NextFloat(0.4f, 0.7f), color); + GeneralParticleHandler.SpawnParticle(orb); + } + + int heal = (int)Math.Round(hit.Damage * 0.02); + if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + return; + + for (int i = 0; i <= 2; i++) + { + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + } + } + ProjLifesteal(target, proj, damageDone, hit.Crit); ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false)); NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true, proj.noEnchantments); diff --git a/Items/Weapons/Ranged/AGunofFireAndIce.cs b/Items/Weapons/Ranged/AGunofFireAndIce.cs new file mode 100644 index 0000000000..dd036d934f --- /dev/null +++ b/Items/Weapons/Ranged/AGunofFireAndIce.cs @@ -0,0 +1,109 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AGunofFireAndIce : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public bool swapType = false; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 36; + Item.scale = 0.75f; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 16; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 12f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + // Ice bullet + if (!swapType) + { + for (int k = 0; k < 8; k++) + { + CritSpark spark = new CritSpark(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.5f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool() ? Color.DeepSkyBlue : Color.LightSkyBlue, Color.White, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile iceShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.5f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = iceShot.Calamity(); + cgp.iceBullet = true; + } + // Fire bullet + if (swapType) + { + for (int k = 0; k < 8; k++) + { + CritSpark spark = new CritSpark(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.5f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed, Color.Yellow, Main.rand.NextFloat(0.3f, 0.7f), Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(-2f, 2f), 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile fireShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.5f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = fireShot.Calamity(); + cgp.fireBullet = true; + } + + swapType = !swapType; + return false; + } + 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() * 7f; + Vector2 itemSize = new Vector2(56, 36); + Vector2 itemOrigin = new Vector2(-24, 3); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.05f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.PhoenixBlaster). + AddIngredient(5). + AddIngredient(5). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/AGunofFireAndIce.png b/Items/Weapons/Ranged/AGunofFireAndIce.png new file mode 100644 index 0000000000..71a1c84bb2 Binary files /dev/null and b/Items/Weapons/Ranged/AGunofFireAndIce.png differ diff --git a/Items/Weapons/Ranged/Arietes41.cs b/Items/Weapons/Ranged/Arietes41.cs new file mode 100644 index 0000000000..6d0f20e088 --- /dev/null +++ b/Items/Weapons/Ranged/Arietes41.cs @@ -0,0 +1,110 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Arietes41 : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public bool swapType = false; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 30; + Item.scale = 0.85f; + Item.damage = 45; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 13; + Item.useAnimation = 13; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2.25f; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = SoundID.Item41; + Item.autoReuse = true; + Item.shootSpeed = 13f; + Item.shoot = ProjectileID.PurificationPowder; + Item.useAmmo = AmmoID.Bullet; + Item.Calamity().canFirePointBlankShots = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + // Shock bullet + if (!swapType) + { + for (int k = 0; k < 8; k++) + { + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.65f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.Turquoise); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile shockShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.65f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = shockShot.Calamity(); + cgp.shockBullet = true; + } + // Life bullet + if (swapType) + { + for (int k = 0; k < 8; k++) + { + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 0.65f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(10, 15 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.White); + GeneralParticleHandler.SpawnParticle(spark); + } + Projectile lifeShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.65f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = lifeShot.Calamity(); + cgp.lifeBullet = true; + } + + swapType = !swapType; + return false; + } + 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() * 7f; + Vector2 itemSize = new Vector2(56, 30); + Vector2 itemOrigin = new Vector2(-24, 3); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.03f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.ShroomiteBar, 3). + AddIngredient(ItemID.FallenStar, 5). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/Arietes41.png b/Items/Weapons/Ranged/Arietes41.png new file mode 100644 index 0000000000..b95d48dd5c Binary files /dev/null and b/Items/Weapons/Ranged/Arietes41.png differ diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs deleted file mode 100644 index 1cb7a8b159..0000000000 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class CursedCapper : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 52; - Item.height = 32; - Item.damage = 31; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item41; - Item.autoReuse = true; - Item.shootSpeed = 14f; - Item.shoot = ProjectileID.CursedBullet; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.CursedBullet, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.PhoenixBlaster). - AddIngredient(ItemID.CursedFlame, 10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/CursedCapper.png b/Items/Weapons/Ranged/CursedCapper.png deleted file mode 100644 index ce5af668df..0000000000 Binary files a/Items/Weapons/Ranged/CursedCapper.png and /dev/null differ diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 0687c8cc4b..1b667957fa 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles; +using System; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,18 +13,17 @@ namespace CalamityMod.Items.Weapons.Ranged public class PearlGod : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - private const int defaultSpread = 1; - private int spread = defaultSpread; - private bool finalShot = false; + public bool swapType = false; public override void SetDefaults() { Item.width = 80; Item.height = 46; - Item.damage = 33; + Item.damage = 90; + Item.scale = 0.75f; Item.DamageType = DamageClass.Ranged; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useTime = 9; + Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; @@ -29,76 +31,105 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item41; Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (spread > 6) + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + + if (Main.zenithWorld) { - spread = defaultSpread; - finalShot = true; + Projectile.NewProjectile(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity, ModContent.ProjectileType(), damage * 3, knockback * 5f, player.whoAmI, 0f, 10f); + return false; } - - float rotation = MathHelper.ToRadians(spread); - if (!finalShot) + // Pearl bullets + if (!swapType) { - int totalLoops = 1; - switch (spread) + for (int k = 0; k < 2; k++) { - case 1: - case 2: - break; - case 3: - case 4: - totalLoops = 2; - break; - case 5: - case 6: - totalLoops = 3; - break; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.4f, 0.65f), color); + GeneralParticleHandler.SpawnParticle(spark); } - - for (int i = 0; i < totalLoops; i++) + for (int k = 0; k < 6; k++) { - int bullet1 = Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); - Main.projectile[bullet1].extraUpdates += spread; - int bullet2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockback * 0.5f, player.whoAmI); - Main.projectile[bullet2].extraUpdates += spread; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + PearlParticle pearl1 = new PearlParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1f), false, Main.rand.Next(40, 45 + 1), Main.rand.NextFloat(0.6f, 0.75f), color, 0.95f, Main.rand.NextFloat(1, -1), true); + GeneralParticleHandler.SpawnParticle(pearl1); + } + for (int k = 0; k < 3; k++) + { + Projectile pearlShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.65f, velocity.RotatedBy(k == 0 ? 0 : k == 1 ? 0.025f : -0.025f), type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = pearlShot.Calamity(); + cgp.pearlBullet = true; } - - int shockblast = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, spread); - Main.projectile[shockblast].extraUpdates += spread; - - spread++; } - else + // Life bullet + if (swapType) { - for (int i = 0; i < 3; i++) + for (int k = 0; k < 8; k++) { - int bigShockblast = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback * 2f, player.whoAmI, 0f, 10f); - Main.projectile[bigShockblast].extraUpdates += 9; + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + SparkParticle spark = new SparkParticle(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.2f, 1.5f), false, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.4f, 0.65f), color); + GeneralParticleHandler.SpawnParticle(spark); } + for (int k = 0; (k < 13); k++) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; - finalShot = false; + Dust dust2 = Dust.NewDustPerfect(itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.35f, 278, velocity.RotatedByRandom(0.25) * Main.rand.NextFloat(0.1f, 0.9f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.3f, 0.45f); + dust2.color = color; + } + Projectile lifeShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.65f, velocity, type, damage, knockback, player.whoAmI); + CalamityGlobalProjectile cgp = lifeShot.Calamity(); + cgp.lifeBullet2 = true; } + swapType = !swapType; return false; } + 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() * 7f; + Vector2 itemSize = new Vector2(80, 46); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.03f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.SpectreBar, 5). AddIngredient(ItemID.ShroomiteBar, 5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs deleted file mode 100644 index 5dd21f7e45..0000000000 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class GoldenGun : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public override void SetDefaults() - { - Item.width = 78; - Item.height = 36; - Item.damage = 5; - Item.useTime = 15; - Item.useAnimation = 15; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.Ichor, 15). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/GoldenGun.png b/Items/Weapons/Typeless/GoldenGun.png deleted file mode 100644 index c3fd046f08..0000000000 Binary files a/Items/Weapons/Typeless/GoldenGun.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 6755615873..6673664dda 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -340,11 +340,6 @@ CrackshotColt: { ''' } -CursedCapper: { - DisplayName: Cursed Capper - Tooltip: Fires cursed bullets -} - DaemonsFlame: { DisplayName: Daemon's Flame Tooltip: @@ -1377,3 +1372,13 @@ MagnaCannon: { Fully charged shots fire an even longer and more rapid burst ''' } + +AGunofFireAndIce: { + DisplayName: A Gun of Fire And Ice + Tooltip: Hot ice and cold fire +} + +Arietes41: { + DisplayName: Arietes 41 + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 613f300021..b9a504451c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -17,11 +17,6 @@ EyeofMagnus: { ''' } -GoldenGun: { - DisplayName: Golden Gun - Tooltip: Shoots a straight line of pure ichor -} - LunicEye: { DisplayName: Lunic Eye Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson index 235f5942ea..c370e8de48 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson @@ -21,3 +21,4 @@ AbsorberAura.DisplayName: Absorber Aura BlueJellyAura.DisplayName: Blue Jelly Aura GreenJellyAura.DisplayName: Green Jelly Aura PinkJellyAura.DisplayName: Pink Jelly Aura +AltTransfusionTrail.DisplayName: Alt Transfusion Trail diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index af9c3b5969..a6f5033fa6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -61,7 +61,6 @@ GhostlyBolt.DisplayName: Bolt GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round -GoldenGunProj.DisplayName: Golden Round GreenLabSeeker.DisplayName: Seeking Mechanism HellfireExplosionFriendly2.DisplayName: Explosion HeronBobber.DisplayName: Heron Bobber diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 7a3b07d462..e41adab39a 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -2525,7 +2525,6 @@ namespace CalamityMod.NPCs.Providence { List exceptionList = new List() { - ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), diff --git a/Particles/PearlParticle.cs b/Particles/PearlParticle.cs new file mode 100644 index 0000000000..5edfb76c23 --- /dev/null +++ b/Particles/PearlParticle.cs @@ -0,0 +1,83 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class PearlParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public float ShrinkSpeed; + public float RotationSpeed; + public bool HitTiles; + public bool hasTileHit; + public float pVelX; + public float pVelY; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/PearlParticle"; + + public PearlParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, float shrinkSpeed = 0.95f, float rotationSpeed = 0, bool hitTiles = false) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + ShrinkSpeed = shrinkSpeed; + RotationSpeed = rotationSpeed; + HitTiles = hitTiles; + } + + public override void Update() + { + if (HitTiles) + { + if (hasTileHit) + { + if (Velocity.X != pVelX) + { + Velocity.X = -pVelX; + } + if (Velocity.Y != pVelY) + { + Velocity.Y = -pVelY; + } + HitTiles = false; + } + if (Collision.SolidCollision(Position, (int)(7f * Scale), (int)(7f * Scale))) + { + hasTileHit = true; + pVelX = Velocity.X; + pVelY = Velocity.Y; + } + } + Scale *= ShrinkSpeed; + RotationSpeed *= ShrinkSpeed; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation += RotationSpeed; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(1f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/PearlParticleGlow").Value; + + spriteBatch.Draw(texture2, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/PearlParticle.png b/Particles/PearlParticle.png new file mode 100644 index 0000000000..4ae737c25d Binary files /dev/null and b/Particles/PearlParticle.png differ diff --git a/Particles/PearlParticleGlow.png b/Particles/PearlParticleGlow.png new file mode 100644 index 0000000000..0b18753df9 Binary files /dev/null and b/Particles/PearlParticleGlow.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 628690cc04..d95894e2db 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -80,6 +80,24 @@ namespace CalamityMod.Projectiles // Adds Brimstone flames to bullets, currently only used by Animosity public bool brimstoneBullets = false; + // Adds fire to bullets, currently used by A Gun of Fire And Ice + public bool fireBullet = false; + + // Adds ice to bullets, currently used by A Gun of Fire And Ice + public bool iceBullet = false; + + // Adds shock to bullets, currently used by Arietes 41 + public bool shockBullet = false; + + // Adds... pearl? to bullets, currently used by Pearl God + public bool pearlBullet = false; + + // Adds lifesteal to bullets, currently used by Arietes 41 + public bool lifeBullet = false; + + // Adds lifesteal to bullets, currently used by Pearl God + public bool lifeBullet2 = false; + // If true, this projectile creates impact sparks upon hitting enemies public bool deepcoreBullet = false; @@ -3704,6 +3722,102 @@ namespace CalamityMod.Projectiles dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.5f, 1f); } + if (fireBullet) + { + if (projectile.timeLeft > 200) + { + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 174 : 6, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + } + } + } + if (iceBullet) + { + if (projectile.timeLeft > 200) + { + float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f; + Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 135 : 137, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + } + } + } + if (shockBullet) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 1.1f, Color.Turquoise * 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(3)) + { + SparkParticle spark2 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.4f), false, 20, 0.4f, Color.Turquoise * 0.75f); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } + if (pearlBullet) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.9f, Color.White * 0.85f); + GeneralParticleHandler.SpawnParticle(spark); + if (Main.rand.NextBool(4)) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + PearlParticle pearl1 = new PearlParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.4f, 0.55f), color, 0.9f, Main.rand.NextFloat(1, -1), true); + GeneralParticleHandler.SpawnParticle(pearl1); + } + } + } + if (lifeBullet) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.8f, Color.White * 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + + for (int i = 0; i < 2; ++i) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, 261, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.65f, 0.9f); + dust.alpha = 100; + } + + } + } + + if (lifeBullet2) + { + float targetDist = Vector2.Distance(player.Center, projectile.Center); + if (projectile.timeLeft > 200 && targetDist < 1400f) + { + SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.9f, Color.White * 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool(3)) + { + int randomColor = Main.rand.Next(1, 3 + 1); + Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki; + SparkParticle spark2 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.4f, color); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + } } } diff --git a/Projectiles/Healing/AltTransfusionTrail.cs b/Projectiles/Healing/AltTransfusionTrail.cs new file mode 100644 index 0000000000..cb362dbc53 --- /dev/null +++ b/Projectiles/Healing/AltTransfusionTrail.cs @@ -0,0 +1,67 @@ +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Healing +{ + public class AltTransfusionTrail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float opacity = 0.3f; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.extraUpdates = 5; + } + + public override void AI() + { + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 15f, MathHelper.Clamp(80f - time, 5, 80)); + if (time == 1) + { + bool direction = Main.rand.NextBool(); + Projectile.velocity = (Projectile.velocity * 10).RotatedBy(direction ? Main.rand.NextFloat(0.6f, 1.8f) : Main.rand.NextFloat(-0.6f, -1.8f)) * 2f; + } + + SparkParticle orb = new SparkParticle(Projectile.Center, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.1f), false, 5, 0.6f, Color.White * opacity); + GeneralParticleHandler.SpawnParticle(orb); + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 63 : 91, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.25f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust.alpha = 100; + dust.noLight = true; + } + + if (Projectile.timeLeft < 300) + { + Projectile.extraUpdates = 12; + if (opacity > 0) + opacity -= 0.01f; + } + time++; + } + public override void OnKill(int timeLeft) + { + Player Owner = Main.player[Projectile.owner]; + for (int i = 0; i < 2; ++i) + { + Particle Plus = new HealingPlus(Owner.Center - new Vector2(Main.rand.Next(-4, 24 + 1), 2), Main.rand.NextFloat(0.2f, 0.5f), new Vector2(0, Main.rand.NextFloat(-2f, -4.5f)) + Owner.velocity, Color.SlateGray * 0.75f, Color.White * 0.75f, Main.rand.Next(15, 20)); + GeneralParticleHandler.SpawnParticle(Plus); + } + } + } +} diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs deleted file mode 100644 index 586fabab1e..0000000000 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ /dev/null @@ -1,117 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GoldenGunProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 2; - } - - public override void AI() - { - if (Projectile.localAI[0] < 5f) - { - Projectile.localAI[0] += 1f; - return; - } - int inc; - for (int i = 0; i < 1; i = inc + 1) - { - for (int j = 0; j < 6; j = inc + 1) - { - float dustX = Projectile.velocity.X / 6f * (float)j; - float dustY = Projectile.velocity.Y / 6f * (float)j; - int dustPosMod = 6; - int goldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod, Projectile.position.Y + (float)dustPosMod), Projectile.width - dustPosMod * 2, Projectile.height - dustPosMod * 2, DustID.Ichor, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[goldenDust]; - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - dust.noGravity = true; - dust.velocity *= 0.3f; - dust.velocity += Projectile.velocity * 0.5f; - dust.position = Projectile.Center; - dust.position.X -= dustX; - dust.position.Y -= dustY; - dust.velocity *= 0.2f; - inc = j; - } - if (Main.rand.NextBool(4)) - { - int dustPosMod2 = 6; - int moreGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)dustPosMod2, Projectile.position.Y + (float)dustPosMod2), Projectile.width - dustPosMod2 * 2, Projectile.height - dustPosMod2 * 2, DustID.Ichor, 0f, 0f, 75, default, 0.65f); - Dust dust = Main.dust[moreGoldenDust]; - dust.velocity *= 0.5f; - dust.velocity += Projectile.velocity * 0.5f; - } - inc = i; - } - } - - public override void OnKill(int timeLeft) - { - Projectile.velocity = Projectile.oldVelocity * 0.2f; - int inc; - for (int k = 0; k < 100; k = inc + 1) - { - int deathGoldenDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Ichor, 0f, 0f, 75, default, 1.2f); - Dust dust = Main.dust[deathGoldenDust]; - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.alpha += 25; - } - if (Main.rand.NextBool()) - { - dust.scale = 0.6f; - } - else - { - dust.noGravity = true; - } - dust.velocity *= 0.3f; - dust.velocity += Projectile.velocity; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - dust.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; - dust.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - dust.position = Projectile.Center; - inc = k; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Ichor, 480); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 480); - } -} diff --git a/Sounds/Item/ElectricHit.ogg b/Sounds/Item/ElectricHit.ogg new file mode 100644 index 0000000000..ea0d2659b6 Binary files /dev/null and b/Sounds/Item/ElectricHit.ogg differ