diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 549f1ae5e8..e3d6d55f26 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Armor.Empyrean; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -36,21 +37,21 @@ namespace CalamityMod.Items.Accessories.Wings player.GetCritChance() += 5; } - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { - float xOffset = 4f; - if (player.direction == 1) + Vector2 spawnPos = player.Center + new Vector2(-25 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + + float partScale = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 partVel = new Vector2(0, 5).RotatedBy(0.5f * player.direction).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 0.8f); + + Particle smoke = new HeavySmokeParticle(spawnPos, partVel, Color.Black, 13, partScale * 0.9f, 0.7f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) { - xOffset = -40f; + Particle spark3 = new GlowOrbParticle(spawnPos, partVel, false, 19, partScale, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark3); } - int index = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, DustID.PurpleTorch, 0f, 0f, 100, default, 2.4f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[index].fadeIn = 2f; - } - Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 180; player.noFallDmg = true; diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 731ed16653..6693d48a8a 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -1,14 +1,20 @@ using CalamityMod.Items.Materials; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.Items.Tools { [LegacyName("GallantPickaxe")] public class GenesisPickaxe : ModItem, ILocalizedModType { + private int swordDirection; + public int time = 0; + public float swingRotation = 0; public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { @@ -41,12 +47,59 @@ namespace CalamityMod.Items.Tools .Register(); } + public override void UseAnimation(Player player) + { + swordDirection = (player.Center - player.Calamity().mouseWorld).X > 1 ? -1 : 1; + time = 0; + swingRotation = 0; + + //float Rot = (player.direction == -1 ? 5.5f : -5.5f) * Main.rand.NextFloat(0.99f, 1.1f); + //Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, Color.LightGreen * 0.9f, Rot, Main.rand.NextFloat(1.7f, 1.83f), new Vector2(1, 1), 6, true, false, true); + //GeneralParticleHandler.SpawnParticle(Smear); + } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + player.itemRotation = swingRotation - 1.7f * swordDirection; + player.itemLocation = player.Center; + player.direction = swordDirection; + + swingRotation = Utils.Remap(time, 0, player.itemAnimationMax, 0, 2.88f * swordDirection); + + if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PurpleTorch); + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.1f; + dust.color = Color.LightGreen; + dust.noGravity = true; } + if (Main.rand.NextBool(4)) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + + float partScale = Main.rand.NextFloat(0.6f, 1.2f); + Vector2 partVel = dustVel * Main.rand.NextFloat(0.1f, 0.3f); + Particle spark3 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale, Color.Black, false, false, false); + GeneralParticleHandler.SpawnParticle(spark3); + Particle spark2 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale * 0.5f, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + + Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale2 = Main.rand.NextFloat(0.5f, 0.8f); + Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.1f, 0.7f); + + //Particle smoke = new GlowOrbParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, false, 9, Main.rand.NextFloat(0.3f, 0.5f), Color.LightGreen); + //GeneralParticleHandler.SpawnParticle(smoke); + //Particle smoke2 = new GlowOrbParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, false, 9, Main.rand.NextFloat(0.3f, 0.5f), Color.Black, false, false, false); + //GeneralParticleHandler.SpawnParticle(smoke2); + + Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(8, 8), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 13, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + + time++; } } } diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index a37ecdd797..5136bc9fc1 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,16 +13,19 @@ namespace CalamityMod.Items.Weapons.Melee [LegacyName("XerocsGreatsword")] public class EntropicClaymore : ModItem, ILocalizedModType { + private int swordDirection; + public int time = 0; + private float swingRotation = 0; public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 130; - Item.height = 106; - Item.damage = 90; + Item.height = 130; + Item.damage = 80; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 26; + Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 26; + Item.useTime = 20; Item.useTurn = true; Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; @@ -33,46 +38,61 @@ namespace CalamityMod.Items.Weapons.Melee public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - hitbox = CalamityUtils.FixSwingHitbox(118, 118); + hitbox = CalamityUtils.FixSwingHitbox(130, 130); } 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(4, 6); - for (int index = 0; index < projAmt; ++index) + for (int i = 0; i < 4; i++) { - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - float damageMult = 0.5f; - switch (index) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - damageMult = 0.65f; - break; - case 2: - type = ModContent.ProjectileType(); - damageMult = 0.8f; - break; - default: - break; - } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.6f), type, damage / 5, knockback * 0.5f, player.whoAmI, 0f, 0f); } return false; } + public override void UseAnimation(Player player) + { + swordDirection = (player.Center - player.Calamity().mouseWorld).X > 1 ? -1 : 1; + time = 0; + swingRotation = 0; + } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(3)) + player.itemRotation = swingRotation - 1.7f * swordDirection; + player.itemLocation = player.Center; + player.direction = swordDirection; + //swingRotation += swordDirection == 1 ? 0.16f : -0.16f; + swingRotation = Utils.Remap(time, 0, player.itemAnimationMax, 0, 2.88f * swordDirection); + if (Main.rand.NextBool()) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Shadowflame); + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 66); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.85f; + dust.color = Color.LightGreen; + dust.noGravity = true; } - } + if (Main.rand.NextBool()) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + float partScale = Main.rand.NextFloat(0.6f, 0.9f); + Vector2 partVel = (dustVel * Main.rand.NextFloat(0.2f, 0.3f)).RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedByRandom(-0.4) * -3; + Vector2 partPos = player.Center + dustVel * 25 + Main.rand.NextVector2Circular(12, 12); + + Particle spark3 = new AltSparkParticle(partPos, partVel, false, 24, partScale, Color.Black); + GeneralParticleHandler.SpawnParticle(spark3); + Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); + GeneralParticleHandler.SpawnParticle(spark2); + } + Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale2 = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.2f, 0.3f); + Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 25 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 19, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + time++; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Particles/SemiCircularSmearFade.cs b/Particles/SemiCircularSmearFade.cs index 8ee2296013..f7e3f0a425 100644 --- a/Particles/SemiCircularSmearFade.cs +++ b/Particles/SemiCircularSmearFade.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Particles { public class SemiCircularSmearFade : Particle { - public override string Texture => "CalamityMod/Particles/SemiCircularSmearVertical"; + public override string Texture => "CalamityMod/Particles/SemiCircularSmearVerticalBlank"; public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; diff --git a/Particles/SemiCircularSmearVerticalBlank.png b/Particles/SemiCircularSmearVerticalBlank.png new file mode 100644 index 0000000000..cf9a7c4edc Binary files /dev/null and b/Particles/SemiCircularSmearVerticalBlank.png differ diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index fa4e7789a9..ce4cd00d17 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -88,11 +88,11 @@ namespace CalamityMod.Projectiles.Magic { if (curves > 1) { - Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0f, scalingTimerMax / 2, false); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0f, scalingTimerMax / 2, false); GeneralParticleHandler.SpawnParticle(blastRing); for (int i = 0; i < 2; i++) { - Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.13f, 0f, scalingTimerMax / 2, true); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.26f, 0f, scalingTimerMax / 2, true); GeneralParticleHandler.SpawnParticle(blastRing2); } Projectile.velocity = Vector2.Zero; diff --git a/Projectiles/Melee/EntropicFlechetteSmall.cs b/Projectiles/Melee/EntropicFlechetteSmall.cs index 1db25a8648..5b077a1587 100644 --- a/Projectiles/Melee/EntropicFlechetteSmall.cs +++ b/Projectiles/Melee/EntropicFlechetteSmall.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.Potions; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,54 +12,96 @@ namespace CalamityMod.Projectiles.Melee public class EntropicFlechetteSmall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - + public float sizeVariance = 2; + public int time = 60; + public int spinDir = 100; + public int waveOften = 30; public override void SetDefaults() { - Projectile.width = 8; - Projectile.height = 8; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.penetrate = 1; + Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 600; + Projectile.timeLeft = 450; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 rotateVector = new Vector2(6f, 12f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) + Player Owner = Main.player[Projectile.owner]; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (spinDir == 100) { - Projectile.localAI[0] = 0f; + spinDir = Main.rand.NextBool() ? 1 : -1; + waveOften = Main.rand.Next(15, 30 + 1); } - else + + if (time % 18 == 0) + sizeVariance = Main.rand.NextFloat(1.5f, 2.5f) * 0.7f; + Projectile.scale = MathHelper.Lerp(Projectile.scale, sizeVariance, 0.09f); + if (time % 2 == 0 && time > 5) { - for (int i = 0; i < 2; i++) + Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, 6, 0.7f, Color.Black); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(8)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + if (time >= 5) + { + NPC target = Projectile.Center.ClosestNPCAt(250); + + if (target == null) { - Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); - Main.dust[darkDust].scale = 1f; - Main.dust[darkDust].noGravity = true; - Main.dust[darkDust].position = Projectile.Center + dustRotate; - Main.dust[darkDust].velocity = Projectile.velocity; + Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 12) + Projectile.velocity += moveToMouse * 0.2f; + else + Projectile.velocity *= 0.9f; + + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); + } + else + { + Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 12) + Projectile.velocity += moveToEnemy * 0.8f; + else + Projectile.velocity *= 0.7f; } } - - int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); - Main.dust[darkestDust].noGravity = true; - Main.dust[darkestDust].velocity *= 0f; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + time++; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 9; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.5f, 1.2f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 2.1f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request("CalamityMod/Particles/WaterFlavored"); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.Black, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.7f, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.5f, SpriteEffects.None); return false; } }