diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index b88f777f11..24dcdd8f01 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -43,10 +44,36 @@ namespace CalamityMod.CalPlayer { int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300) attempt.uncommon = Main.rand.NextBool(uncommonRate); + + // These roll result bools are individually stored for the rarifying visuals int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050) - attempt.uncommon = Main.rand.NextBool(rareRate); + bool rareRoll = Main.rand.NextBool(rareRate); + attempt.rare = rareRoll; + int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250) - attempt.uncommon = Main.rand.NextBool(veryRareRate); + bool veryRareRoll = Main.rand.NextBool(veryRareRate); + attempt.veryrare = veryRareRoll; + + Vector2 basePos = new Vector2(attempt.X * 16f, attempt.Y * 16f); + if (rareRoll || veryRareRoll) + { + for (int i = 0; i < 8; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -9f)).RotatedByRandom(MathHelper.ToRadians(18f)); + float scale = Main.rand.NextFloat(0.5f, 1.5f); + CritSpark spark = new(position, velocity, Color.White, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), scale, 36, 0.2f, scale * 2f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + for (int i = 0; i < 6; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-3f, -0.5f)).RotatedByRandom(MathHelper.ToRadians(12f)); + PearlParticle pearl = new(position, velocity, false, 24, Main.rand.NextFloat(0.5f, 1f), Main.hslToRgb(Main.rand.NextFloat(), 1f, (rareRoll || veryRareRoll) ? 0.75f : 1f)); + GeneralParticleHandler.SpawnParticle(pearl); + } } } } diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index 9947723237..ff90145473 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -1,6 +1,5 @@ -using System.Linq; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public class UrchinMace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 42; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } @@ -37,11 +38,6 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().mouseWorldListener = true; } - public override bool CanUseItem(Player player) - { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index ce940220d3..cd1ca7c044 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -723,7 +723,7 @@ EnchantedPearl: { ''' Increases fishing power by 10 Increases chance to catch crates and loot-containing fish by 15% - Crates are 25% more likely to be higher quality + Crate catches emit pearls and are 25% more likely to be higher quality ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 965bf0790f..bfd871688a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1424,14 +1424,9 @@ UltimusCleaver: { Tooltip: Launches damaging homing sparks and explodes on enemy hits } -UrchinFlail: { - DisplayName: Urchin Flail - Tooltip: Launch an urchin ball, which shoots a spike on contact with an enemy -} - UrchinMace: { DisplayName: Urchin Mace - Tooltip: Throws out a whirlpool when released at full charge + Tooltip: Throws out a whirlpool when released } VanishingPoint: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index f1bbe599eb..421e5a47bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -299,7 +299,6 @@ TruePurityProjection.DisplayName: Purity Projection TumbleweedRolling.DisplayName: Rolling Tumbleweed TyphonsGreedBubble.DisplayName: Typhon's Greed UltimusCleaverDust.DisplayName: Ultimus Flame -UrchinMaceProjectile.DisplayName: Urchin Mace UrchinSpikeFugu.DisplayName: Urchin Spike VirulentBeeWave.DisplayName: Virulent Bee Wave VirulentWave.DisplayName: Virulent Wave diff --git a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs index e30fdd76b2..d6aed5d61b 100644 --- a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs @@ -328,9 +328,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// Reserved for extra AI that is always ran regardless of state. Does nothing by default.
- /// Example cases include shooting projectiles in a similar manner to Flower Pow. + /// Example cases include shooting projectiles in a similar manner to Flower Pow.
+ /// Return false to entirely override base flail behaviour. ///
- public virtual void ExtraBehavior() { } + public virtual bool ExtraBehavior() => true; /// /// Handles simple chain drawing. Can be overridden for cases such as chains with multiple frames/variants. @@ -422,31 +423,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles break; } - ExtraBehavior(); - - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); - - // Non-symmetric rotation (symmetric is just in this if condition here) - if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + if (ExtraBehavior()) { - if (Projectile.velocity.Length() > 1f) - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); + + // Non-symmetric rotation (symmetric is just in this if condition here) + if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + { + if (Projectile.velocity.Length() > 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + else + Projectile.rotation += Projectile.velocity.X * 0.1f; + } else - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - else - { - Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); - Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); - } + { + Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); + Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); + } - Projectile.timeLeft = 2; - Owner.heldProj = Projectile.whoAmI; - Owner.SetDummyItemTime(2); - Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); - if (Projectile.Center.X < Owner.MountedCenter.X) - Owner.itemRotation += MathHelper.Pi; - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + Projectile.timeLeft = 2; + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); + if (Projectile.Center.X < Owner.MountedCenter.X) + Owner.itemRotation += MathHelper.Pi; + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs index 5941aa2188..d1da4b4c20 100644 --- a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs +++ b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { // Randomly play grass sounds idly if it is moving/spinning if ((CurrentFlailState == FlailState.Spinning || Projectile.velocity.Length() > 2f) && Projectile.soundDelay <= 0) @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails AuraScale = MathHelper.Clamp(AuraScale + 1f / MaxAuraTime, 0f, 1f); if (AuraScale < 0.15f) - return; + return true; // The dust machine for (int i = 0; i < (int)(10 * AuraScale); i++) @@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails } else AuraScale = MathHelper.Clamp(AuraScale - 3f / MaxAuraTime, 0f, 1f); + + return true; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs similarity index 54% rename from Projectiles/Melee/UrchinMaceProjectile.cs rename to Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 619af44ec1..17eb3bd5ad 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,64 +1,73 @@ using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee +namespace CalamityMod.Projectiles.Melee.MaceFlails { - public class UrchinMaceProjectile : ModProjectile, ILocalizedModType + public class UrchinMaceProj : BaseMaceFlailProjectile { - public new string LocalizationCategory => "Projectiles.Melee"; - public Player Owner => Main.player[Projectile.owner]; + // The entire chain is on the mace sprite, in which the player swings public override string Texture => "CalamityMod/Items/Weapons/Melee/UrchinMace"; + public override string ChainTexturePath => string.Empty; - public static float MaxWindup = 110; - public ref float Windup => ref Projectile.ai[0]; - public float WindupProgress => MathHelper.Clamp(Windup, 0, MaxWindup) / MaxWindup; - public static float whirlpoolDamageMultiplier = 2f; + // This flail only runs through one state (spin), thereby making most parameters unnecessary to fill out + public override int AssociatedItemID => ModContent.ItemType(); + public override int SpinIFrames => 15; + public override float SpinHitboxRadius => 64f; + public override float SpinVerticalFactor => 1f; // This flail moves circular + public override float LaunchSpeed => 22f; + + public static float MaxWindup = 45f; public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + base.SetDefaults(); + Projectile.localNPCHitCooldown = SpinIFrames * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.ownerHitCheck = true; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + public override void SpinAI(float launchSpeed) { - //Prevent spam click abuse - if (Windup < Projectile.localNPCHitCooldown) - return false; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; + if (Projectile.owner == Main.myPlayer) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); + Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); + if (!Owner.channel && WindupProgress >= 1f) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, toMouse * launchSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item7, Owner.MountedCenter); + Projectile.Kill(); + return; + } - float collisionPoint = 0f; - float bladeLength = 70 * Projectile.scale; - float bladeWidth = 30 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); - } - - public override void AI() - { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + if (StateTimer == MaxWindup) + { + for (int i = 0; i < 25; i++) + { + Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); + Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; + } + } + } Projectile.velocity = Vector2.Zero; - Projectile.rotation += (WindupProgress * MathHelper.PiOver4 / 1.5f) * Owner.direction; - - if (Owner.channel) - { - Projectile.timeLeft = 2; - UpdateOwnerVars(); - } + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; if (WindupProgress > 0.5f) { @@ -73,31 +82,17 @@ namespace CalamityMod.Projectiles.Melee } } - Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + StateTimer++; + } + public override bool ExtraBehavior() + { if (Projectile.soundDelay <= 0) { SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce, Owner.MountedCenter); Projectile.soundDelay = 28; } - if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer) - { - SoundEngine.PlaySound(SoundID.Item43, Owner.MountedCenter); - - for (int i = 0; i < 25; i++) - { - Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); - Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); - dust.noGravity = true; - } - } - - Windup++; - } - - public void UpdateOwnerVars() - { float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); //"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction) @@ -111,12 +106,13 @@ namespace CalamityMod.Projectiles.Melee armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true); } - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + + Projectile.timeLeft = 2; Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; + Owner.SetDummyItemTime(2); + return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -130,26 +126,15 @@ namespace CalamityMod.Projectiles.Melee } } - //If we don't do that, the hit enemies get knocked back towards you if you hit them from the right?? - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // This would knock enemies away consistently, but i'm choosing to go with the other option - //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); - - //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them - modifiers.HitDirectionOverride = Owner.direction; - } - public override bool PreDraw(ref Color lightColor) { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); - - Texture2D maceTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D whirlpoolTexture = ModContent.Request("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value; + Texture2D maceTexture = TextureAssets.Projectile[Type].Value; + Texture2D whirlpoolTexture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f; - float whirlpoolOpacity = WindupProgress * 0.2f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; - float whirlpoolRotation = Windup * 0.34f * Owner.direction; + float whirlpoolOpacity = WindupProgress * 0.2f + MathF.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; + float whirlpoolRotation = StateTimer * 0.34f * Owner.direction; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0); @@ -158,20 +143,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 handleOrigin = new Vector2(0, maceTexture.Height); float maceRotation = Projectile.rotation + MathHelper.PiOver4; Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); - return false; } - - public override void OnKill(int timeLeft) - { - //Spawn a whirlpool typhoon after sending it out - if (WindupProgress >= 1f && Projectile.owner == Main.myPlayer) - { - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Main.MouseWorld - Owner.position).SafeNormalize(Vector2.One) * 25f, ModContent.ProjectileType(), (int)(Projectile.damage * whirlpoolDamageMultiplier), Projectile.knockBack, Projectile.owner, 0, 0f); - } - - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } } } diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs index 3b78e442ef..1073486d6b 100644 --- a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { if (Main.rand.NextBool(3)) { @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails spore.noGravity = true; spore.scale = 1.5f; } + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 42d3b112e9..0b983a87b8 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -42,6 +42,16 @@ namespace CalamityMod.Projectiles.Melee Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f)); dust.noGravity = true; } + + Vector2 trailOffset = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(40f, 48f); + Dust trail = Dust.NewDustPerfect(Projectile.Center + trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); + trail = Dust.NewDustPerfect(Projectile.Center - trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/RemsRevengeExplosion.cs b/Projectiles/Melee/RemsRevengeExplosion.cs index 3d1c9452c0..2a44122aa2 100644 --- a/Projectiles/Melee/RemsRevengeExplosion.cs +++ b/Projectiles/Melee/RemsRevengeExplosion.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Melee { @@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public override void SetDefaults() { Projectile.width = Projectile.height = 80; @@ -19,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 5; + Projectile.timeLeft = 20; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -27,21 +31,42 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.ai[1] > 0f) - return; - - // Makeshift metal-blood explosion sound that is good enough ig - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); - for (int p = 0; p < 10; p++) + if (Time == 0f) { - Vector2 velocity = (-Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(75f)) * Main.rand.NextFloat(4f, 6f); - float scale = Main.rand.NextFloat(0.6f, 2f); - Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); - GeneralParticleHandler.SpawnParticle(blood); + // Makeshift metal-blood explosion sound that is good enough ig + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f + 0.03f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Projectiles/FireProj", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 2f + 0.22f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RosyBrown, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 2f, 24, true); + GeneralParticleHandler.SpawnParticle(outerGlow); + + for (int p = 0; p < 16; p++) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(8f, 12f); + float scale = Main.rand.NextFloat(0.6f, 2f); + Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(blood); + } } - Projectile.ai[1]++; + + Projectile.scale = MathHelper.Lerp(0f, 1f, PiecewiseAnimation(Time / 20f, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) })); + Time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 89652246eb..3938a7e9cc 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -46,6 +46,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } + + if (Main.rand.NextBool(8)) + { + Dust offTrail = Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2Circular(0.2f, 0.2f)); + offTrail.noGravity = true; + offTrail.scale = Main.rand.NextFloat(0.6f, 1.2f); + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120); diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs index 1d5e366f57..31a9c02fae 100644 --- a/Systems/Collections/PierceResistExceptionList.cs +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs index 27808b0d0a..6dab54e61f 100644 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using Terraria.ID; @@ -32,7 +33,7 @@ namespace CalamityMod.Systems.Collections ProjectileID.ChargedBlasterCannon, ProjectileID.MedusaHead, - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(),