diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 03a1819d1b..064a534dba 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -176,9 +176,6 @@ namespace CalamityMod.Balancing // 35% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); - // 25% resist to Lucrecia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - // 20% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); diff --git a/Buffs/Summon/AqueousHunterDroneBuff.cs b/Buffs/Summon/AqueousHunterDroneBuff.cs new file mode 100644 index 0000000000..292d0df8e0 --- /dev/null +++ b/Buffs/Summon/AqueousHunterDroneBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AqueousHunterDroneBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.aqueousHunterDrone; + } +} diff --git a/Buffs/Summon/AqueousHunterDroneBuff.png b/Buffs/Summon/AqueousHunterDroneBuff.png new file mode 100644 index 0000000000..728c691251 Binary files /dev/null and b/Buffs/Summon/AqueousHunterDroneBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 75a59a992e..248bc63465 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -275,6 +275,11 @@ namespace CalamityMod.CalPlayer public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; public int DragonsBreathAudioCooldown2 = 0; + public int lucreciaEnergy = 0; + public int lucreciaEnergyTimer = 0; + public bool lucreciaEnergyPaused = false; + public bool lucreciaEnergyMaxSFXPlayed = false; + private int lucreciaParticleTimer = 0; public int PhotoAudioCooldown = 0; public int PhotoTimer = 90; /// Cooldown variable used to add a delay between Anahita's Arpeggio uses. @@ -1516,6 +1521,7 @@ namespace CalamityMod.CalPlayer public bool starSwallowerPetFroge = false; public bool snakeEyes = false; public bool poleWarper = false; + public bool aqueousHunterDrone = false; public bool causticDragon = false; public bool plaguebringerPatronSummon = false; public bool howlTrio = false; @@ -2665,6 +2671,7 @@ namespace CalamityMod.CalPlayer starSwallowerPetFroge = false; snakeEyes = false; poleWarper = false; + aqueousHunterDrone = false; causticDragon = false; plaguebringerPatronSummon = false; howlTrio = false; @@ -3212,6 +3219,7 @@ namespace CalamityMod.CalPlayer burningSeaBurnOut = 0; flareGunOverheat = 0; hellbornShots = 0; + lucreciaEnergy = 0; garandShots = 0; searedPanCounter = 0; searedPanTimer = 0; diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 7a911dbef1..03d45ac712 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -66,6 +66,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + if ((HasCustomDash && Player.dashDelay < 0 && UsedDash.dashTime < UsedDash.dashStartup)) + { + UsedDash.DashStartupEffects(Player); + UsedDash.dashTime++; + return; + } else if (HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime == UsedDash.dashStartup ) + { + if (DoADash(UsedDash.CalculateDashSpeed(Player),true)) + UsedDash.OnDashEffects(Player); + } + var source = new ProjectileSource_PlayerDashHit(Player); // Handle collision slam-through effects. @@ -102,6 +113,7 @@ namespace CalamityMod.CalPlayer } } } + UsedDash.dashTime++; } if (Player.dashDelay > 0) @@ -187,7 +199,8 @@ namespace CalamityMod.CalPlayer } // Dash delay depends on the type of dash used. - Player.dashDelay = dashDelayToApply; + if (!(HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime <= UsedDash.dashStartup+10)) + Player.dashDelay = dashDelayToApply; if (UsedDash.IsOmnidirectional) { @@ -223,12 +236,16 @@ namespace CalamityMod.CalPlayer // Handle first-frame effects. else if (HasCustomDash && !Player.mount.Active) { + UsedDash.dashTime = 0; if (DoADash(UsedDash.CalculateDashSpeed(Player))) - UsedDash.OnDashEffects(Player); + if (UsedDash.dashStartup <= 0) + UsedDash.OnDashEffects(Player); + else + UsedDash.OnDashStartupEffects(Player); } } - public bool HandleHorizontalDash(out DashDirection direction) + public bool HandleHorizontalDash(out DashDirection direction, bool forceDash = false) { direction = DashDirection.Directionless; bool dashWasExecuted = false; @@ -236,7 +253,7 @@ namespace CalamityMod.CalPlayer // If the manual hotkey is bound, standard Terraria dashes cannot be triggered by double tapping. var manualDashHotkeys = CalamityKeybinds.DashHotkey.GetAssignedKeys(); bool manualHotkeyBound = (manualDashHotkeys?.Count ?? 0) > 0; - bool pressedManualHotkey = manualHotkeyBound && CalamityKeybinds.DashHotkey.JustPressed; + bool pressedManualHotkey = manualHotkeyBound && (CalamityKeybinds.DashHotkey.JustPressed || forceDash); int dashDirectionToUse = 0; @@ -418,9 +435,9 @@ namespace CalamityMod.CalPlayer return justDashed; } - public bool DoADash(float dashSpeed) + public bool DoADash(float dashSpeed, bool forceDash = false) { - bool justDashed; + bool justDashed = forceDash; bool omnidirectionalDash = UsedDash?.IsOmnidirectional ?? false; DashDirection direction; @@ -434,7 +451,14 @@ namespace CalamityMod.CalPlayer else if (omnidirectionalDash) justDashed = HandleOmnidirectionalDash(out direction); else - justDashed = HandleHorizontalDash(out direction); + justDashed = HandleHorizontalDash(out direction, forceDash); + + if (justDashed && !forceDash && UsedDash.dashStartup > 0) + { + Player.timeSinceLastDashStarted = 0; + Player.dashDelay = -1; + return justDashed; + } // Make dash movements happen if ready. if (justDashed) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index db8f69a48c..bfc7d7a072 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -166,6 +166,9 @@ namespace CalamityMod.CalPlayer // Drawing parameters UpdateDrawingParameters(); + // Handle Lucrecia's passive energy effects + HandleLucreciaEffects(); + // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. @@ -272,7 +275,7 @@ namespace CalamityMod.CalPlayer } // First Frame dash effects - bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame); + bool dashStart = (Player.dashDelay == -1 && ((!HasCustomDash && IsFirstDashFrame) || (HasCustomDash && UsedDash.DashTimeAdjustedForStartup == 1))); int dir = MathF.Sign(Player.velocity.X); if (dashStart) @@ -371,6 +374,51 @@ namespace CalamityMod.CalPlayer Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3()); } + if (Player.HeldItem.type == ModContent.ItemType() && lucreciaEnergy > 0) + { + if (lucreciaEnergy == Lucrecia.MaxEnergy && !lucreciaEnergyPaused) + { + lucreciaEnergyPaused = true; + lucreciaEnergyTimer = 0; + } + + lucreciaEnergyTimer++; + + // If the energy is at max, pause for 180 ticks + if (lucreciaEnergyPaused) + { + if (lucreciaEnergyTimer >= 1 && !lucreciaEnergyMaxSFXPlayed) + { + SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center); + lucreciaEnergyMaxSFXPlayed = true; + + } + // If the pause is Done, resume decrementing. + if (lucreciaEnergyTimer >= 180) + { + lucreciaEnergyPaused = false; + lucreciaEnergyTimer = 0; + lucreciaEnergy--; + } + } + else // Decrementing + { + lucreciaEnergyMaxSFXPlayed = false; + // Once every 8 ticks + if (lucreciaEnergyTimer >= 8) + { + lucreciaEnergy--; + lucreciaEnergyTimer = 0; + } + } + } + else + { + // Reset the timer and pause state if the player isn't holding the weapon. + lucreciaEnergyTimer = 0; + lucreciaEnergyPaused = false; + } + if (lAmbergris) { if (dashStart) @@ -383,7 +431,7 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33% Player.dashDelay--; - if (Player.dashDelay == -1) + if (Player.dashDelay == -1 && !(HasCustomDash && UsedDash.DashTimeAdjustedForStartup < 1)) Player.velocity.X *= 0.9f; } @@ -4447,6 +4495,47 @@ namespace CalamityMod.CalPlayer } #endregion + #region Lucrecia Effects + + public void HandleLucreciaEffects() + { + int lucreciaItemID = ModContent.ItemType(); + if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 0) + { + lucreciaParticleTimer--; + + // If the timer is at or below zero, spawn a particle. + if (lucreciaParticleTimer <= 0) + { + // Reset the timer (spawn rate depends on energy) + lucreciaParticleTimer = (int)(20 - 15 * (lucreciaEnergy / 60)); + + float radius = Main.rand.NextFloat(160f, 190f); // Distance from center + float spawnAngle = Main.rand.NextFloat(MathHelper.TwoPi); // Random angle along the whole radius + + Vector2 spawnPosition = Player.Center + spawnAngle.ToRotationVector2() * radius; + + // Scale opacity with energy + float opacity = lucreciaEnergy / (float)Lucrecia.MaxEnergy; + Color color = Main.rand.NextBool() ? Color.MediumPurple : Color.CornflowerBlue; + color *= opacity; + + if (lucreciaEnergy >= 100) + { + color *= 1.6f; // Brighter + } + + Vector2 dummyVelocity = Vector2.Zero; // We dont want the argument where this is used to have influence on the actual path + float rotationSpeed = 0.04f; + + var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI); + GeneralParticleHandler.SpawnParticle(particle); + } + } + } + #endregion + + #region Energy Shields private void EnergyShields() { diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index e3797e4f2d..a96ce8fa39 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -29,26 +30,39 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { Time += 2; float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true)); - for (int i = 0; i < 3; i++) + if (DashTimeAdjustedForStartup <= 18) { - float offsetRotationAngle = player.velocity.ToRotation() + Time / 5f; - float radius = (15f + (float)Math.Cos(Time / 3f) * 12f) * radiusFactor; - Vector2 dustPosition = player.Center - player.velocity * 2; - dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; - Dust dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(5) ? 181 : 295); - dust.alpha = 220; - dust.noGravity = true; - dust.velocity = player.velocity * 0.8f; - dust.scale = Main.rand.NextFloat(1.7f, 2.0f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - Dust dust2 = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) + (player.velocity * 1.5f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.7f, 1.9f)); - dust2.alpha = 170; - dust2.noGravity = true; - dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + for (int d = 0; d < 2; d++) + { + Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); + hFlameDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + hFlameDust.noGravity = hFlameDust.type == 180 ? false : true; + hFlameDust.fadeIn = 0.5f; + if (hFlameDust.type == 180) + { + hFlameDust.scale = Main.rand.NextFloat(0.8f, 1.2f); + hFlameDust.velocity += new Vector2(0, -2.5f) * Main.rand.NextFloat(0.8f, 1.2f); + } + + Dust dust = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Circular(6, 6) - player.velocity * 2, DustID.FrostStaff); + dust.velocity = -player.velocity * Main.rand.NextFloat(0.6f, 1.4f); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); + dust.noGravity = true; + if (d < 1) + { + Particle spark = new CustomSpark(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.25f), Main.rand.NextBool() ? Color.Fuchsia : Color.Cyan, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.4f, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } } // Dash at a faster speed than the default value. @@ -57,6 +71,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 18) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 5f; diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 34262feeae..f73fb8ca42 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.UI.States; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -24,35 +25,39 @@ namespace CalamityMod.CalPlayer.Dashes public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - // Nothing + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + // Dash at a faster speed than the default value. + dashSpeed = 12.5f; // Spawn fire dust around the player's body. - for (int d = 0; d < 4; d++) - { - Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); - holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - if (Main.rand.NextBool()) - holyFireDashDust.fadeIn = 0.1f; - } - if (Main.rand.NextBool(3)) - { + if (DashTimeAdjustedForStartup > 14) + return; + for (int d = 0; d < 3; d++) + { + Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); + holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); + holyFireDashDust.scale *= Main.rand.NextFloat(2f, 2.4f); + holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + holyFireDashDust.noGravity = true; + if (Main.rand.NextBool()) + holyFireDashDust.fadeIn = 0.1f; + } Vector2 dustPosition = player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f); Dust dust = Dust.NewDustPerfect(dustPosition, 222, -player.velocity * Main.rand.NextFloat(0.15f, 0.4f), 0, default, 0.5f); dust.noGravity = false; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - } } public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 14) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 8ff41a5806..36fca673b6 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -27,8 +27,15 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + if (DashTimeAdjustedForStartup <= 16) for (int d = 0; d < 4; d++) { Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 222 : 162, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); @@ -59,6 +66,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 16) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 3.5f; diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 9c94df600a..4dc1749dca 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -17,16 +17,16 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - //nothing left, could add a sound or other effect if we want later + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + if (DashTimeAdjustedForStartup <= 12) for (int d = 0; d < 3; d++) { Dust iceDashDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(8) ? 223 : 180, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); @@ -43,6 +43,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 12) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/PlayerDashEffect.cs b/CalPlayer/Dashes/PlayerDashEffect.cs index 4ea5d0a336..e57802a47d 100644 --- a/CalPlayer/Dashes/PlayerDashEffect.cs +++ b/CalPlayer/Dashes/PlayerDashEffect.cs @@ -9,14 +9,34 @@ namespace CalamityMod.CalPlayer.Dashes // For the sake of easy access without the need for stored instances, this property is defined as static instead of abstract. // Derived classes should use the new keyword on this member to define their own version of it. public static string ID { get; } + public int dashTime { get; set; } + public virtual int dashStartup => 0; + + public int DashTimeAdjustedForStartup => dashTime - dashStartup; public abstract DashCollisionType CollisionType { get; } public abstract bool IsOmnidirectional { get; } public abstract float CalculateDashSpeed(Player player); - + /// + /// Effects that happen once when the main dash starts + /// + /// public virtual void OnDashEffects(Player player) { } + /// + /// Effects that happen once when the dash startup starts + /// This does not run on dashes without set startup + /// + /// + + public virtual void OnDashStartupEffects(Player player) { } + /// + /// Effects that run during the dash startup time + /// This does not run on dashes without set startup + /// + /// + public virtual void DashStartupEffects(Player player) { } public virtual void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { } diff --git a/Cooldowns/LucreciaEnergy.cs b/Cooldowns/LucreciaEnergy.cs new file mode 100644 index 0000000000..23a6f489a9 --- /dev/null +++ b/Cooldowns/LucreciaEnergy.cs @@ -0,0 +1,75 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class LucreciaEnergy : CooldownHandler + { + private float AdjustedCompletion => instance.timeLeft / (float)Lucrecia.MaxEnergy; + private Color TextColor => Color.MediumPurple; + private Color TextBorderColor = Color.AntiqueWhite; + + public static new string ID => "LucreciaEnergy"; + public override bool CanTickDown => false; + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => $"CalamityMod/Cooldowns/{ID}"; + public override string OutlineTexture => $"CalamityMod/Cooldowns/{ID}Outline"; + public override string OverlayTexture => $"CalamityMod/Cooldowns/{ID}Overlay"; + + public override Color OutlineColor => Color.SlateGray; + public override Color CooldownStartColor => Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.DarkBlue, Color.SlateGray, instance.Completion); + + public override void ApplyBarShaders(float opacity) + { + // Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + // Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + } +} diff --git a/Cooldowns/LucreciaEnergy.png b/Cooldowns/LucreciaEnergy.png new file mode 100644 index 0000000000..9891d6fd0b Binary files /dev/null and b/Cooldowns/LucreciaEnergy.png differ diff --git a/Cooldowns/LucreciaEnergyOutline.png b/Cooldowns/LucreciaEnergyOutline.png new file mode 100644 index 0000000000..247f332da8 Binary files /dev/null and b/Cooldowns/LucreciaEnergyOutline.png differ diff --git a/Cooldowns/LucreciaEnergyOverlay.png b/Cooldowns/LucreciaEnergyOverlay.png new file mode 100644 index 0000000000..851597883b Binary files /dev/null and b/Cooldowns/LucreciaEnergyOverlay.png differ diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs index 41ecff817f..c0a21645a7 100644 --- a/Effects/ArsenalEffects.cs +++ b/Effects/ArsenalEffects.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Effects // Plasma public static int ArsenalPlasmaDust = ModContent.DustType(); - public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f); + public static Color ArsenalPlasmaColor = new Color(154, 255, 0); // Laser public static int ArsenalLaserDust = ModContent.DustType(); public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f); diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 9ba8791b8d..c8e65d2c08 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -39,56 +39,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgardian Aegis ram dash modPlayer.DashID = AsgardianAegisDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Counterparts, similar debuffs to vanilla Ankh Shield debuffs, or upgrades thereof) - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor - player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned - player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow - player.buffImmune[BuffID.Blackout] = true; // "Stronger" Darkness - - // Additional debuff immunities (Everything from Ornate Shield + Asgard's Valor) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; - - // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - - // Immune to God Slayer Inferno itself - player.buffImmune[ModContent.BuffType()] = true; } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 3f7bff607d..7ceab1566b 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardsValor : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardsValor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -33,42 +33,17 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgard's Valor ram dash modPlayer.DashID = AsgardsValorDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Everything from Ornate Shield + fiery stuff) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.AnkhShield). AddIngredient(). AddIngredient(). + AddIngredient(ItemID.HallowedBar, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index c941a263df..babe4c2a83 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class ElysianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class ElysianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; @@ -36,23 +36,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Elysian Aegis ram dash modPlayer.DashID = ElysianAegisDash.ID; player.dashType = 0; - - // Vaguely inherited Ankh Shield effects I guess player.noKnockback = true; - player.fireWalk = true; - - // Debuff immunities - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 40d0834c14..30e331049d 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -20,21 +20,14 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 2; // This has a ram dash, it should give a bit less defense due to how good it is + Item.defense = 2; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - // Ornate Shield ram dash player.Calamity().DashID = OrnateShieldDash.ID; player.dashType = 0; - - // Cold debuff immunities (Do not fear, this accessory is post Cryogen!) - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 3f20df2b6a..f9987ef183 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -6,7 +6,9 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Physics; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -1350,6 +1352,80 @@ namespace CalamityMod.Items //Calamity Permanent Upgrades shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType(); + + + // -- Vanilla Boss Shimmer Drop Cycles -- + // These cycles follow the order of: Melee Weapons A to Z -> Ranged Weapons A to Z -> Magic Weapons A to Z -> Summon Weapons A to Z -> Rogue Weapons A to Z (Based off of their in-game names) + // Note that only a select amount of vanilla bosses have an array of equally-likely weapon drops, so the amount of drop pools affected may seem odd at first glance. + + // Queen Bee + shimmerTransmute[ItemID.BeeKeeper] = ItemID.BeesKnees; + shimmerTransmute[ItemID.BeesKnees] = ItemID.BeeGun; + shimmerTransmute[ItemID.BeeGun] = ItemID.BeeKeeper; + + // Deerclops + shimmerTransmute[ItemID.LucyTheAxe] = ItemID.PewMaticHorn; + shimmerTransmute[ItemID.PewMaticHorn] = ItemID.WeatherPain; + shimmerTransmute[ItemID.WeatherPain] = ItemID.HoundiusShootius; + shimmerTransmute[ItemID.HoundiusShootius] = ItemID.LucyTheAxe; + + // Wall of Flesh + shimmerTransmute[ItemID.BreakerBlade] = ItemID.ClockworkAssaultRifle; + shimmerTransmute[ItemID.ClockworkAssaultRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.LaserRifle; + shimmerTransmute[ItemID.LaserRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FireWhip; + shimmerTransmute[ItemID.FireWhip] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.BreakerBlade; + + // Plantera + shimmerTransmute[ItemID.FlowerPow] = ItemID.Seedler; + shimmerTransmute[ItemID.Seedler] = ItemID.GrenadeLauncher; + shimmerTransmute[ItemID.GrenadeLauncher] = ItemID.VenusMagnum; + shimmerTransmute[ItemID.VenusMagnum] = ItemID.LeafBlower; + shimmerTransmute[ItemID.LeafBlower] = ItemID.NettleBurst; + shimmerTransmute[ItemID.NettleBurst] = ItemID.WaspGun; + shimmerTransmute[ItemID.WaspGun] = ItemID.FlowerPow; + + // Golem + shimmerTransmute[ItemID.EyeoftheGolem] = ItemID.SunStone; + shimmerTransmute[ItemID.SunStone] = ItemID.GolemFist; + shimmerTransmute[ItemID.GolemFist] = ItemID.PossessedHatchet; + shimmerTransmute[ItemID.PossessedHatchet] = ItemID.Stynger; + shimmerTransmute[ItemID.Stynger] = ItemID.HeatRay; + shimmerTransmute[ItemID.HeatRay] = ItemID.StaffofEarth; + shimmerTransmute[ItemID.StaffofEarth] = ItemID.EyeoftheGolem; + + // Duke Fishron + shimmerTransmute[ItemID.FishronWings] = ItemID.Flairon; + shimmerTransmute[ItemID.Flairon] = ItemID.Tsunami; + shimmerTransmute[ItemID.Tsunami] = ItemID.BubbleGun; + shimmerTransmute[ItemID.BubbleGun] = ItemID.RazorbladeTyphoon; + shimmerTransmute[ItemID.RazorbladeTyphoon] = ItemID.TempestStaff; + shimmerTransmute[ItemID.TempestStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FishronWings; + + // Empress of Light (Yes these are actually the IDs) + shimmerTransmute[ItemID.RainbowWings] = ItemID.PiercingStarlight; + shimmerTransmute[ItemID.PiercingStarlight] = ItemID.FairyQueenRangedItem; + shimmerTransmute[ItemID.FairyQueenRangedItem] = ItemID.FairyQueenMagicItem; + shimmerTransmute[ItemID.FairyQueenMagicItem] = ItemID.SparkleGuitar; + shimmerTransmute[ItemID.SparkleGuitar] = ItemID.RainbowWhip; + shimmerTransmute[ItemID.RainbowWhip] = ItemID.EmpressBlade; + shimmerTransmute[ItemID.EmpressBlade] = ItemID.RainbowWings; + + // Moon Lord + shimmerTransmute[ItemID.Meowmere] = ItemID.StarWrath; + shimmerTransmute[ItemID.StarWrath] = ItemID.Terrarian; + shimmerTransmute[ItemID.Terrarian] = ItemID.Celeb2; + shimmerTransmute[ItemID.Celeb2] = ItemID.SDMG; + shimmerTransmute[ItemID.SDMG] = ItemID.LastPrism; + shimmerTransmute[ItemID.LastPrism] = ItemID.LunarFlareBook; + shimmerTransmute[ItemID.LunarFlareBook] = ItemID.MoonlordTurretStaff; + shimmerTransmute[ItemID.MoonlordTurretStaff] = ItemID.RainbowCrystalStaff; + shimmerTransmute[ItemID.RainbowCrystalStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.Meowmere; + } #endregion } diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 3af6d8f825..105dd1799c 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.DraedonMisc mageDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 3, mageDisplay); - int summonItem = ModContent.ItemType(); + int summonItem = ModContent.ItemType(); TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{summonItem}] {CalamityUtils.GetItemName(summonItem)}"); summonDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 4, summonDisplay); diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs similarity index 69% rename from Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs rename to Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 15fda0cf58..8ab0339f1c 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -6,23 +6,29 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class StarSwallowerContainmentUnit : ModItem, ILocalizedModType + public class AqueousHunterDrone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/ShrimpFire"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ShrimpMissileHit"); + public static readonly SoundStyle Sound1 = new("CalamityMod/Sounds/Item/ShrimpSound1"); + public static readonly SoundStyle Sound2 = new("CalamityMod/Sounds/Item/ShrimpSound2"); + public static readonly SoundStyle Surprise = new("CalamityMod/Sounds/Item/ShrimpSurprise"); public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 18; - Item.height = 28; + Item.width = 34; + Item.height = 32; Item.shootSpeed = 10f; - Item.damage = 24; + Item.damage = 30; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; @@ -30,33 +36,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 2.25f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item15; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.8f; - modItem.ChargePerAltUse = 0f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) { - int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, new Vector2(mouse.X, player.Center.Y - 600), Vector2.Zero, type, damage, knockback, player.whoAmI); + Main.projectile[p].localAI[2] = player.ownedProjectileCounts[Item.shoot]; if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } return false; } - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png new file mode 100644 index 0000000000..4c5c16cd38 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png differ diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png new file mode 100644 index 0000000000..b069a6dde7 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png differ diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index e9a0937621..b42c097c68 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -1,41 +1,68 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Lucrecia : ModItem, ILocalizedModType + public class Lucrecia : BaseSwordHoldoutItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static int MaxEnergy = 100; + + public override int ProjectileType => ModContent.ProjectileType(); + public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 90; + Item.useStyle = ItemUseStyleID.Shoot; + Item.damage = 170; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 30; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4.2f; + Item.useAnimation = Item.useTime = 34; + Item.shootSpeed = 10f; Item.knockBack = 8.25f; - Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + + Item.autoReuse = true; + Item.channel = true; + // Item.noMelee = true; + // Item.noUseGraphic = true; + base.SetDefaults(); + } - public override bool MeleePrefix() => true; + public override bool AltFunctionUse(Player player) + { + return true; + } + + + public override void HoldItem(Player player) + { + if (player.Calamity().cooldowns.TryGetValue(LucreciaEnergy.ID, out var cooldown)) + { + cooldown.timeLeft = player.Calamity().lucreciaEnergy; + } + else + { + player.AddCooldown(LucreciaEnergy.ID, 0); + } + } + + // public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). AddIngredient(5). - AddIngredient(). + AddIngredient(ItemID.FallenStar, 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 9d2effc04d..5e1b8da3e9 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,11 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Ranged public class Norfleet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public int loadedShots = 3; public override void SetStaticDefaults() { @@ -49,27 +46,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Funny punishment for trying to cheeese with Norfleet - bool cheater = player.Calamity().NorfleetCounter >= 3 && player.Calamity().NorfleetCounter < 1000; - if (player.Calamity().NorfleetCounter >= 1000) - loadedShots = 1; - - if (cheater) - { - SoundStyle fire = new("CalamityMod/Sounds/Item/NuhUhUh"); - SoundEngine.PlaySound(fire, player.Center); - } - - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, (cheater ? 1000 : 0), loadedShots); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - - player.Calamity().NorfleetCounter++; - loadedShots--; - if (loadedShots <= 0) - loadedShots = 3; return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index ed14a54750..5920e13c94 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1073,6 +1073,11 @@ AquaticStar: { Description: The aquatic star will protect you } +AqueousHunterDroneBuff: { + DisplayName: Aqueous Hunter Drone Buff + Description: Unfortunately incapable of producing fried rice +} + AstralProbeBuff: { DisplayName: Astral Probe Description: The astral probe will protect you diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 0c10d1af98..c8885e38e9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -229,15 +229,7 @@ AsgardianAegis: { ''' Allows the ability to dash, empowered by a cosmic inferno This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Burning, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, - Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, - Brain Rot, Burning Blood, Heavy Bleeding, Laceration, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno + Grants immunity to knockback ''' } @@ -247,13 +239,7 @@ AsgardsValor: { ''' Allows the ability to ram dash This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Slow, Confused, Silenced, Cursed, - Darkness, Mighty Wind, Stoned, Brimstone Flames, Burning + Grants immunity to knockback ''' } @@ -734,14 +720,9 @@ ElysianAegis: { ''' Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage - Grants immunity to knockback, fire blocks, as well as multiple debuffs + Grants immunity to knockback + 'Blessed by the Profaned Flame' ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Cursed Inferno, Shadowflame, Daybroken, - Holy Flames, Brimstone Flames, Burning - ''' - FlavorTooltip: "'Blessed by the Profaned Flame'" } EnchantedPearl: { @@ -1281,7 +1262,6 @@ OrnateShield: { ''' Allows the ability to dash This dash can ram through enemies without taking damage - Grants immunity to Chilled, Frostburn, Frostbite, and Frozen ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index b30eecd5a4..c3a3783cdf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -3949,8 +3949,8 @@ PolypSand: { } TableCoralLeft: { - DisplayName: Table Coral - Tooltip: "" + DisplayName: Table Coral + Tooltip: "" } VolcanicSand: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index a1ee116328..d0cbc0922e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -10,6 +10,19 @@ AerialTracker: { ''' } +AqueousHunterDrone: { + DisplayName: P-PMA: Aqueous Hunter Drone + Tooltip: + ''' + Summons a shrimp drone that fires bursts of homing plasma missiles + while holding any summon weapon to command the shrimp to launch a vertical missile barrage + Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground + Each shrimp uses 4 minion slots + [c/1FBFF:'When pursuing the adherents of Gods, Yharim believed no stone should be left unturned.] + [c/1FBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] + ''' +} + Auger: { DisplayName: P-GSS: Auger Tooltip: @@ -223,16 +236,6 @@ SnakeEyes: { ''' } -StarSwallowerContainmentUnit: { - DisplayName: Star Swallower Containment Unit - Tooltip: - ''' - Summons a biomechanical frog that vomits plasma onto enemies - [c/1FFBFF:'These simplistic creatures were mechanized to autonomously transport plasma.] - [c/1FFBFF:They are vastly more servicable than their mundane organic counterparts.'] - ''' -} - SystemBane: { DisplayName: System Bane Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 12dfdc08ba..b1ec177391 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -800,8 +800,10 @@ Lucrecia: { DisplayName: Lucrecia Tooltip: ''' - Fires a DNA chain - Finesse + [c/9370db:Fires a spiraling darklight shard when swung] + [c/837ce4:Hits with the blade itself build energy] + [c/7489ee:Energy is lost over time but briefly stops depleting after reaching its maximum] + [c/6495f7:Press with maximum energy to fire a double helix comet] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index cf9b90ba21..f4be7e2fa1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -306,3 +306,7 @@ MirrorBladeProjectile.DisplayName: Mirror Blade MirrorBladeSlash.DisplayName: Mirror Blade Slash MirrorBladeSlashCreator.DisplayName: Mirror Blade Slash Creator GildedProboscisProj.DisplayName: Gilded Proboscis +LucreciaProj.DisplayName: Lucrecia +LucreciaDNATrailCreator.DisplayName: Lucrecia DNA +LucreciaDoubleHelix.DisplayName: Lucrecia Helix Comet +LucreciaSmallProjectile.DisplayName: Lucrecia diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 9dc5d84ee5..0863e6de92 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -8,6 +8,7 @@ AnomalysNanogunHoldout.DisplayName: The Anomaly's Nanogun AnomalysNanogunMPFBBoom.DisplayName: MPFB Explosion AnomalysNanogunMPFBDevastator.DisplayName: MPFB Devastator AnomalysNanogunPlasmaBeam.DisplayName: Plasma Beam +AqueousHunterDroneSummon.DisplayName: Plasma Shrimp AugerHoldout.DisplayName: P-GSS Auger AugerSlash.DisplayName: Auger Slash AugerPull.DisplayName: Auger Pull @@ -40,6 +41,7 @@ PulseRifleShot.DisplayName: Pulse Bolt PulseTurret.DisplayName: Pulse Turret PulseTurretShot.DisplayName: Pulse Bolt ShortCircuitHook.DisplayName: Short Circuit Hook +ShrimpPlasmaMissile.DisplayName: Plasma Shrimp Missile SnakeEyesSummon.DisplayName: Snake Eyes SnakeEyesProjectile.DisplayName: Inescapable Bolt StarSwallowerAcid.DisplayName: Acid diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 5d270374d2..42c737aff9 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -119,6 +119,7 @@ Cooldowns: { KillModeCooldown: Kill Mode Cooldown LifeSteal: Life Steal Cooldown LionHeartShield: Energy Shell Cooldown + LucreciaEnergy: Lucrecia Energy M1GarandShots: Chambered Rounds MasterChefShieldDurability: MJOLNIR Shield Level MasterChefShieldRecharge: MJOLNIR Shield Recharge diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 51133250cd..b8550398d8 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1167,7 +1167,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/Particles/RoundedStar.png b/Particles/RoundedStar.png new file mode 100644 index 0000000000..f88faa5601 Binary files /dev/null and b/Particles/RoundedStar.png differ diff --git a/Particles/RoundedStarParticle.cs b/Particles/RoundedStarParticle.cs new file mode 100644 index 0000000000..fbb55e8e3b --- /dev/null +++ b/Particles/RoundedStarParticle.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using CalamityMod.Particles; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Particles +{ + public class RoundedStarParticle : Particle + { + public override string Texture => "CalamityMod/Particles/RoundedStar"; + + public float RotationSpeed; + public float Deceleration; + + public bool UseSpiralAI; + private int OwnerIndex; + private float InitialRadius; + private float OrbitalAngle; + + public override bool UseCustomDraw => true; + public RoundedStarParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float rotationSpeed, float deceleration, bool useSpiralAI, Vector2 spiralTarget, int ownerIndex) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifetime; + RotationSpeed = rotationSpeed; + Deceleration = deceleration; + UseSpiralAI = useSpiralAI; + OwnerIndex = ownerIndex; + + if (UseSpiralAI) + { + // Store the initial radius and angle relative to the player + Vector2 directionToPlayer = Position - Main.player[OwnerIndex].Center; + InitialRadius = directionToPlayer.Length(); + OrbitalAngle = directionToPlayer.ToRotation(); + } + } + + public override void Update() + { + if (UseSpiralAI) + { + OrbitalAngle += RotationSpeed; + + float fadeScale = 1f - (Time / (float)Lifetime); + float currentRadius = InitialRadius * fadeScale; + + Vector2 playerCenter = Main.player[OwnerIndex].Center; + + Vector2 newRelativePosition = OrbitalAngle.ToRotationVector2() * currentRadius; + + // Update the particle's position. + Position = playerCenter + newRelativePosition; + } + else + { + // If not using the spiral AI, apply deceleration + Velocity *= Deceleration; + Position += Velocity; + } + + Rotation += RotationSpeed; + Time++; + if (Time >= Lifetime) + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float fade = 1f - (Time / (float)Lifetime); + float scaleFade = Scale * fade; + + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * fade, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs new file mode 100644 index 0000000000..49af06b549 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs @@ -0,0 +1,428 @@ +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AqueousHunterDroneSummon : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public int time = 0; + public ref float attackTimer => ref Projectile.ai[0]; + public ref float interactionTimer => ref Projectile.ai[1]; + public int interactionPoint = 600; // The time needed before shimps do their idle animation + public int cooldownGiven = 450; + public bool pressedRight => Projectile.ai[2] == 5; + public bool doingSpecialAttack = false; + public float moveSpeed = 30; // Lower is actually faster + public NPC targetedNPC; // The NPC being targeted + public float tailRot = 0; // Extra rotation on the tail + public float tailRecoil = 0; // Recoil for the tail after firing + public int facingDir = 0; + public Vector2 headPlace; + public Vector2 tailPlace; + public float lastFirePositionX; // Used for some of the movement + public Vector2 chillSpot; // Stored position for intro animation and some movement + public Vector2 spawnAnimStart; // Second stored position for the spawn animation + public Vector2 lastTargetCenter; + public int attackDowntime = 0; // Timer used for post attack effects + public int surpriseTimer = 0; // Used for the jump animation when surprized + public float slidingDirection = 0; // Value that lerps from left to right + public int animationClickTime = 70; // Time before body and tail click together in spawn anim + public bool doSpin = false; // If the shrimp will spin for it's attack + public float specialAttackfx = 0; // spinnning effect opacity mult + public override void SetStaticDefaults() + { + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 1; + Projectile.height = 1; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 4f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + int shrimpNum = Owner.ownedProjectileCounts[Projectile.type]; + facingDir = Math.Sign(Projectile.velocity.X); + GrantBuffs(Owner); + if ((targetedNPC == null || targetedNPC.life <= 0 || !targetedNPC.CanBeChasedBy() || attackDowntime == 20) && attackDowntime < 30) + targetedNPC = Projectile.Center.MinionHoming(2000f, Owner); + + // All the stuff for the spawn animation + if (time < animationClickTime + 20) + { + if (time == 0) + { + chillSpot = Projectile.Center; + spawnAnimStart = Projectile.Center; + int chosenDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity.X = (chosenDir * 16); + tailRot = -2f * chosenDir; + attackTimer += 8 * Projectile.localAI[2]; + } + SpawnAnim(); + facingDir = Math.Sign(Projectile.velocity.X); + time++; + return; + } + + slidingDirection = MathHelper.Lerp(slidingDirection, Owner.direction, 0.03f); + + bool isSummonWeapon = Owner.HeldItem.DamageType.CountsAsClass(DamageClass.Summon); + if (Owner.Calamity().mouseRight && Owner.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && Owner.Calamity().arsenalCooldown <= 0 && isSummonWeapon) + { + Projectile.ai[2] = 5; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == Projectile.type && p.owner == Projectile.owner) + { + p.ai[2] = 5; + } + } + } + + if (doingSpecialAttack) + { + SpecialAttack(); + } + else + { + specialAttackfx = MathHelper.Lerp(specialAttackfx, 0, 0.15f); + if (targetedNPC != null || attackDowntime > 0) + { + lastTargetCenter = (targetedNPC == null ? Owner.Center : targetedNPC.Center); + Attacking(); + } + else + { + Passive(); + CheckForSpecialAttack(); + } + } + + if (tailRecoil > 0) + tailRecoil = MathHelper.Lerp(tailRecoil, 0, 0.2f); + if (attackDowntime > 0) + attackDowntime--; + time++; + SetVisualPlacement(); + } + public void CheckForSpecialAttack() + { + if (pressedRight) + { + Projectile.ai[2] = 0; + doingSpecialAttack = true; + attackTimer = 0; + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 12; + else + Projectile.velocity *= 1.3f; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + } + public void SpecialAttack() + { + interactionTimer = 0; + int length = 33; + specialAttackfx = MathHelper.Lerp(specialAttackfx, 1, 0.2f); + + facingDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity *= 0.98f; + Projectile.rotation += ((MathHelper.TwoPi * 3) / length) * facingDir; + + tailRot = MathHelper.Lerp(tailRot, 0.75f * -facingDir, 0.2f); + for (int i = -1; i <= 1; i += 2) + { + bool noFall = !Main.rand.NextBool(5); + Vector2 vel = Vector2.UnitY.RotatedBy(Projectile.rotation * -5) * i; + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 43 * specialAttackfx, dustStyle); + dust.scale = Main.rand.NextFloat(0.8f, 1.1f) + (noFall ? 0 : 0.5f); + dust.velocity = vel.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - MathHelper.PiOver4 * facingDir) * Main.rand.NextFloat(4, 5.5f); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 0.7f; + } + + if (attackTimer % 3 == 0) + { + int usedTimer = (int)(facingDir == -1 ? (length - attackTimer) : attackTimer); + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + Vector2 shootVel = (MathHelper.PiOver2 / 10 * (int)(usedTimer / 3 - 1)).ToRotationVector2().RotatedBy(-MathHelper.PiOver2 - MathHelper.PiOver4); + Vector2 shootPlace = Projectile.Center + shootVel * 10; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, attackTimer + 1); + } + attackTimer++; + if (attackTimer > length) + { + attackTimer = 8 * Projectile.localAI[2]; + doingSpecialAttack = false; + } + } + public void SpawnAnim() + { + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + headPlace = Projectile.Center + headDist; + if (time < animationClickTime) + { + tailRot += 0.05f * Projectile.direction; + Projectile.velocity *= 0.98f; + Projectile.Center -= Projectile.velocity; + spawnAnimStart = new Vector2(spawnAnimStart.X, Owner.Center.Y - 700); + + tailPlace = chillSpot + tailDist + (Vector2.UnitY * ((float)Math.Pow(time, 2.05f) * 0.085f) + Vector2.UnitX * (16 - Math.Abs(Projectile.velocity.X)) * 10 * Projectile.direction); + } + else + tailPlace = Projectile.Center + tailDist; + + if (time > animationClickTime - 40) + { + if (time == animationClickTime - 1) + { + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver4 * Projectile.direction) * 3; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Pitch = 0.4f }, Projectile.Center); + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.6f, Pitch = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = -9; i <= 9; i++) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace + Main.rand.NextVector2Circular(5, 5), dustStyle); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.Pi * (Math.Sign(i) == 1 ? 0 : 1)) * Main.rand.NextFloat(1, 5); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 0.1f; + if (i == -1) + i++; + } + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(tailPlace, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 0.4f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (time > animationClickTime - 1) + { + Projectile.velocity *= 0.97f; + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + else + { + Projectile.Center = Vector2.Lerp(spawnAnimStart, tailPlace, Utils.GetLerpValue(animationClickTime - 40, animationClickTime, time, true)); + } + } + } + public void Passive() + { + float sine = (float)Math.Sin((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi); + float sine2 = (float)Math.Sin(((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi) * 2); + + TailRotationBasedOnMovement(); + + attackTimer = 8 * Projectile.localAI[2]; + + if (interactionTimer == interactionPoint) + { + chillSpot = Owner.Center + Main.rand.NextVector2CircularEdge(190, 190); + } + Projectile.rotation = Projectile.rotation.AngleLerp(0, 0.04f); + Vector2 destination = interactionTimer > interactionPoint ? (chillSpot + new Vector2(220 * sine, -90 + 130 * sine2)) : Owner.Center + new Vector2((-50 + -85 * Projectile.localAI[2]) * slidingDirection, -80 + 30 * sine); + + if (surpriseTimer == 0) + Projectile.velocity = (destination - Projectile.Center) / (moveSpeed + (interactionTimer > interactionPoint ? 20 : 0) - 9 + 9 * sine2); + else + surpriseTimer--; + if (interactionTimer > interactionPoint) + { + if (time % 25 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Vector2.UnitY * 20, -Vector2.UnitY.RotatedByRandom(0.1f) * Main.rand.NextFloat(3.3f, 5.5f), "CalamityMod/Projectiles/Magic/MelterNote1", false, 32, Main.rand.NextFloat(1.2f, 1.3f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0, 0.7f)), new Vector2(1, 1), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % (480 + Projectile.localAI[2] * 120) == 0 && Owner.miscCounter != 0) + { + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.3f, Pitch = 0f + Projectile.localAI[2] * 0.1f * (Projectile.localAI[2] % 2 == 0 ? -1 : 1), MaxInstances = 10 }, Projectile.Center); + } + } + if (Owner.Center.Distance(Projectile.Center) > 450 && interactionTimer > interactionPoint && Owner.velocity.Length() > 5) + { + CombatText.NewText(Projectile.Hitbox, Effects.ArsenalEffects.ArsenalPlasmaColor, "!", true); + SoundEngine.PlaySound(AqueousHunterDrone.Surprise with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center); + surpriseTimer = 25; + interactionTimer = 0; + } + if (Projectile.velocity.Length() < 5) + interactionTimer++; + else if (interactionTimer > 0 && interactionTimer < interactionPoint) + interactionTimer -= 2; + } + public void Attacking() + { + interactionTimer = 0; + facingDir = Math.Sign(Projectile.Center.DirectionTo(lastTargetCenter).X); + if (tailRecoil > 1 && doSpin) // Little spin + { + Projectile.rotation += 0.35f * facingDir; + } + else + Projectile.rotation = (Projectile.rotation).AngleLerp(tailPlace.DirectionTo(lastTargetCenter).ToRotation() + (facingDir == -1 ? MathHelper.Pi : 0) + (MathHelper.PiOver4 * -facingDir), 0.18f); + if (Utils.Distance(Projectile.Center, lastTargetCenter) > 250 && Projectile.velocity.Length() < 15) + Projectile.velocity += tailPlace.DirectionTo(lastTargetCenter) * 0.3f; + else + Projectile.velocity *= 0.96f; + if (lastTargetCenter.Y - 80 < tailPlace.Y) + Projectile.velocity.Y -= 0.7f; + + Projectile.velocity *= 0.99f; + if (attackDowntime > 35) // Reposition to somewhere on the other side of the target + { + Projectile.velocity.X += 0.8f * Math.Sign(lastTargetCenter.X - lastFirePositionX); + TailRotationBasedOnMovement(); + } + else + { + CheckForSpecialAttack(); + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + if (attackTimer > 60) // Fire the missiles + { + Vector2 shootVel = tailPlace.DirectionTo(lastTargetCenter); + Vector2 shootPlace = tailPlace + shootVel * 10; + + lastFirePositionX = Projectile.Center.X; + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = 0; i < 13; i++) + { + bool noFall = !Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance); + dust.velocity = shootVel.RotatedBy(variance) * Main.rand.NextFloat(9, 9.5f) * (1 - Math.Abs(variance)); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 1.1f; + } + + Particle bolt2 = new CustomPulse(shootPlace, shootVel * 0.2f, Effects.ArsenalEffects.ArsenalPlasmaColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), shootVel.ToRotation(), 0f, 0.6f, 23); + GeneralParticleHandler.SpawnParticle(bolt2); + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(shootPlace, shootVel * 0.2f, "CalamityMod/Particles/BloomCircle", false, 28, 0.6f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1f, 0.5f), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = -1; i <= 1; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel.RotatedBy(0.5f * i) * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, 0); + + doSpin = Main.rand.NextBool(5); + if (doSpin) + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.4f, Pitch = 0.2f, MaxInstances = 10 }, Projectile.Center); + tailRecoil = 25f; + Projectile.velocity += shootVel * (doSpin ? -18 : -9); + attackTimer = 0; + attackDowntime = 60; + } + attackTimer++; + } + public void TailRotationBasedOnMovement() + { + float sine = (float)Math.Sin(time * 0.1f / MathHelper.Pi); + tailRot = (sine * 0.2f) + 1.2f * (float)Math.Pow(Utils.GetLerpValue(0, 12 * facingDir, Projectile.velocity.X, true), 1.5f) * facingDir; + } + public void SetVisualPlacement() + { + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.05f / MathHelper.Pi); + Vector2 shake = new Vector2(3 * sine * (facingDir), 7 * sine2); + Vector2 visualPlace = Projectile.Center + shake + Vector2.UnitY * (surpriseTimer > 20 ? Utils.GetLerpValue(25, 20, surpriseTimer) : 1 - (float)Math.Pow(Utils.GetLerpValue(20, 15, surpriseTimer, true), 2)) * -25; + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + Vector2 recoilPlace = ((Projectile.rotation - (facingDir == -1 ? MathHelper.Pi : 0) - (MathHelper.PiOver4 * -facingDir)).ToRotationVector2() * -tailRecoil); + headPlace = visualPlace + headDist; + tailPlace = visualPlace + tailDist + recoilPlace; + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().aqueousHunterDrone = false; + } + if (player.Calamity().aqueousHunterDrone) + { + Projectile.timeLeft = 2; + } + } + } + public override bool MinionContactDamage() => false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D head = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBody").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBodyGlow").Value; + Texture2D tail = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTail").Value; + Texture2D glow2 = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTailGlow").Value; + Texture2D spin = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey").Value; + Color drawColor = Projectile.GetAlpha(lightColor); + bool left = facingDir == -1; + float rotation = Projectile.rotation; + + // Tail + Main.EntitySpriteDraw(tail, tailPlace - Main.screenPosition, null, drawColor, rotation + tailRot, new Vector2(left ? tail.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition, null, Color.White, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float headFadeIn = (float)Math.Pow(Utils.GetLerpValue(0, animationClickTime - 25, time, true), 8); + // Head + Main.EntitySpriteDraw(head, headPlace - Main.screenPosition, null, drawColor * headFadeIn, rotation + sine * 0.1f, head.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow, headPlace - Main.screenPosition, null, Color.White * headFadeIn, rotation + sine * 0.1f, glow.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + // Spin effect + Main.EntitySpriteDraw(spin, Vector2.Lerp(headPlace, tailPlace, 0f) - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * specialAttackfx, rotation * 1.8f, spin.Size() * 0.5f, Projectile.scale * 0.53f * specialAttackfx, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + if (tailRecoil > 0) // Glowing on the gun after firing + { + float fade = Utils.GetLerpValue(0, 15, tailRecoil, true); + for (int i = 0; i < 12; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (2 + 2 * fade); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition + vel, null, Color.White with { A = 0 } * fade, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpBody.png b/Projectiles/DraedonsArsenal/ShrimpBody.png new file mode 100644 index 0000000000..6a9768e1f1 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBody.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png new file mode 100644 index 0000000000..5ddf245160 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs new file mode 100644 index 0000000000..b38c669e64 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs @@ -0,0 +1,181 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ShrimpPlasmaMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public NPC closestNPC; + public Vector2 offset = Vector2.Zero; + public bool hitTile = false; + public float randomRate = 0; + public float randomSize = 0; + public override void SetStaticDefaults() + { + //ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; // The balance people will say if this is needed + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + if (time == 0) + { + randomRate = Main.rand.NextFloat(1, 3); + randomSize = Main.rand.NextFloat(1, 5); + } + float sine = (float)Math.Sin(time * 0.075f / MathHelper.Pi * randomRate); + + if (time > 0 && Projectile.numHits == 0) + { + if (Utils.Distance(Owner.Center, Projectile.Center) < 1400) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * -0.01f, "CalamityMod/Particles/BloomCircle", false, 12, 0.18f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(0.3f, 1), true, true, 0, false, false, 0.3f, glowCenterScale: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.ai[2] == 0) + { + if (time > 10) + { + if (closestNPC == null || closestNPC.life <= 0 || !closestNPC.CanBeChasedBy()) + closestNPC = Projectile.Center.ClosestNPCAt(900); + if (closestNPC != null) + { + Projectile.timeLeft++; + float distMult = ((float)Math.Pow(Utils.GetLerpValue(140, 80, Projectile.Center.Distance(closestNPC.Center), true), 3)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestNPC, true, 0.2f + 0.3f * distMult, 8, 0.99f - 0.1f * distMult, accelerate: true); + } + } + } + else + { + Vector2 goalPosition = Owner.Calamity().mouseWorld + offset; + int fallTime = 300 - (int)Projectile.ai[2] * Projectile.extraUpdates; + offset = Vector2.UnitX * sine * 15 * randomSize; + if (time == fallTime) + { + Projectile.timeLeft = 600; + Projectile.extraUpdates = 6; + Projectile.scale = 1.5f; + } + if (time > fallTime) + { + float distMult = (float)Math.Pow(Utils.GetLerpValue(480, 340, time, true), 3); + + Vector2 moveTo = (goalPosition - Projectile.Center).SafeNormalize(Vector2.UnitX); + + if (Projectile.velocity.Y < 8) + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X += moveTo.X * 0.5f; + Projectile.velocity.X *= 0.975f; + } + else + Projectile.timeLeft++; + } + + if (Main.rand.NextBool(5)) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = -0.2f; + } + } + if (Collision.SolidCollision(Projectile.Center, 8, 8) && Projectile.numHits == 0 && Projectile.ai[2] > 0 && Projectile.Center.Y > Owner.Calamity().mouseWorld.Y && Projectile.scale > 1) + { + hitTile = true; + Projectile.numHits = 1; + Explode(); + } + time++; + } + public void Explode() + { + float lifetimeMult = (hitTile ? 5 : 1); + if (hitTile) + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 0; + Projectile.timeLeft = (int)(12 * lifetimeMult); + Projectile.velocity = Vector2.Zero; + for (int i = 0; i < (int)(12 * Projectile.scale); i++) + { + bool noFall = !Main.rand.NextBool(5); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.9f, 1.7f) * (noFall ? 2 : 0.75f) * Projectile.scale; + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6.4f, 7.5f) * (noFall ? 0.7f : 1.2f) * Projectile.scale; + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = (noFall ? 4.5f * Projectile.scale : 1f); + } + SoundEngine.PlaySound(AqueousHunterDrone.Hit with { Volume = 0.4f * Projectile.scale, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 30 }, Projectile.Center); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.95f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f * Projectile.scale, 14); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * Projectile.scale, (int)(10 * lifetimeMult)); + GeneralParticleHandler.SpawnParticle(bolt3); + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(17 * lifetimeMult), 0.6f * Projectile.scale, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (hitTile) + { + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(20 * lifetimeMult), 0.6f * Projectile.scale * lifetimeMult, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.35f, new Vector2(1, 1), true, true, 0, false, false, glowOpacity: 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.scale > 1) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 2.5f; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + Explode(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + { + float minMult = 0.5f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * 0.5f; + } + } + public override bool? CanDamage() => ((time > 5 && Projectile.ai[2] == 0) || (Projectile.scale > 1)) ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * (Projectile.numHits > 0 ? 10 : 1) * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpTail.png b/Projectiles/DraedonsArsenal/ShrimpTail.png new file mode 100644 index 0000000000..ea5481c028 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTail.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpTailGlow.png b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png new file mode 100644 index 0000000000..0d7d5e8d71 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png differ diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs deleted file mode 100644 index 671209f27b..0000000000 --- a/Projectiles/Melee/DNA.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DNA : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public static int TotalSegments = 10; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 72; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[1] == 0f) - { - Projectile.alpha -= 100; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.ai[1] = 1f; - - // This projectile normally does not move by itself, so this will manually move it one time only - // This is only for the first segment - if (Projectile.ai[0] == 0f) - { - Projectile.ai[0]++; - Projectile.position += Projectile.velocity; - } - - // Spawn the next segment - if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments) - { - int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment); - } - } - } - else // Begin fading out - { - int AlphaPerFrame = 15; - Projectile.alpha += AlphaPerFrame; - if (Projectile.alpha == AlphaPerFrame * 14) - { - for (int i = 0; i < 3; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); - dust.noGravity = true; - dust.velocity *= 0.5f; - } - } - - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); - } - - // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile - public override bool ShouldUpdatePosition() => false; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); - - public override void OnKill(int timeLeft) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); - } - } -} diff --git a/Projectiles/Melee/DNA.png b/Projectiles/Melee/DNA.png deleted file mode 100644 index 67167a046b..0000000000 Binary files a/Projectiles/Melee/DNA.png and /dev/null differ diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs new file mode 100644 index 0000000000..a7de6b3724 --- /dev/null +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaDNATrailCreator : ModProjectile + { + private List oldPositionsLeft = new List(); + private List oldPositionsRight = new List(); + private int trailTimer = 0; + // The timer is initialized with a delay. It will reset to 6 after the first shot. + private int middleStreakTimer = 40; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 200; + Projectile.height = 170; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.extraUpdates = 12; + Projectile.timeLeft = 2400; + Projectile.minion = true; // Scuffed but it prevents the projectile from being culled in a few situations + Projectile.alpha = 255; + } + + public override void AI() + { + Player owner = Main.player[Projectile.owner]; + trailTimer++; + + // Very volatile values... + float amplitude = 86f; + float frequency = 0.039f; + + // Makes a perpendicular/mirrored trail, AKA a double helix + Vector2 perpendicular = Vector2.Normalize(new Vector2(-Projectile.velocity.Y, Projectile.velocity.X)); + + // Calculate the sine wave value. + float sineWave = (float)Math.Cos(trailTimer * frequency); + + // Calculate offset based on the pattern of the sinewave and subtract the proj's dimensions to be accurate + Vector2 offsetLeft = (perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + Vector2 offsetRight = (-perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + + oldPositionsLeft.Add(Projectile.Center + offsetLeft); + oldPositionsRight.Add(Projectile.Center + offsetRight); + + // The timer will now correctly decrease once per AI update. + middleStreakTimer--; + + if (middleStreakTimer <= 0) + { + // Reset the timer for the next shot. + middleStreakTimer = 6; + + // Spawn the main trail + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + + // Remove old positions after 120 + int maxTrailLength = 120; + if (oldPositionsLeft.Count > maxTrailLength) + oldPositionsLeft.RemoveAt(0); + if (oldPositionsRight.Count > maxTrailLength) + oldPositionsRight.RemoveAt(0); + } + + private float WidthFunction(float completionRatio) + { + return MathHelper.Lerp(12f, 0f, completionRatio); + } + + + private Color LeftColorFunction(float completionRatio) + { + Color baseColor = Color.MediumPurple * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + private Color RightColorFunction(float completionRatio) + { + Color baseColor = Color.CornflowerBlue * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + + + public override bool PreDraw(ref Color lightColor) + { + MiscShaderData trailShader = GameShaders.Misc["CalamityMod:TrailStreak"]; + trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + + // Use the separate color functions for each trail + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + return false; + } + } +} diff --git a/Projectiles/Melee/LucreciaProj.cs b/Projectiles/Melee/LucreciaProj.cs new file mode 100644 index 0000000000..be57981ef4 --- /dev/null +++ b/Projectiles/Melee/LucreciaProj.cs @@ -0,0 +1,323 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Projectiles.Melee.Shortswords; +using System.Runtime.InteropServices; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaProj : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override bool useMeleeSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 310; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; + public override SoundStyle? UseSound => SoundID.Item71 with { Volume = 0.85f }; + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + public override int swingTime { get; set; } + public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } + public override float lineCollisionLength => 82; + + // Boolshit + public bool helixFired = false; + public bool gotEnergyThisSwing = false; + public bool trailFXTriggered = false; + public bool particlesSpawned = false; + public bool sparkTriggered = false; + + public int standardStartupTime = 8; + public int standardSwingTime = 14; + public int standardCooldownTime = 7; + private bool IsThrusting => Projectile.localAI[0] == 1; + public bool IsAlternateThrust { get; set; } + public int thrustStartupTime = 33; + public int thrustForwardTime = 7; + public int thrustCooldownTime = 17; + + public override void Defaults() + { + Projectile.extraUpdates = 6; + Projectile.noEnchantmentVisuals = true; + Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup + Projectile.width = Projectile.height = 54; + } + + public override void Spawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + var calamityPlayer = player.Calamity(); + + // Store the base use time from the item + int baseUseTime = BaseItem.useTime; + + if (player.altFunctionUse == 2) + { + // Check for energy before the projectile exists + if (calamityPlayer.lucreciaEnergy < 100) + { + Projectile.Kill(); + return; + } + + IsAlternateThrust = true; + + // Scale all time vars correctly + StartupTime = (int)(thrustStartupTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(thrustForwardTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(thrustCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 36; + useMeleeSize = true; + UseSound = SoundID.DD2_JavelinThrowersAttack; + OffsetDistance = -30; + RotateInStartup = 0.8f; + RotateInCooldown = 1f; + Projectile.knockBack = 15f; + + calamityPlayer.lucreciaEnergy = 0; // Remove energy for startup + } + else + { + IsAlternateThrust = false; + + // Scale all time vars correctly + StartupTime = (int)(standardStartupTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(standardSwingTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(standardCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + OffsetDistance = 36; + RotateInStartup = 0.8f; + RotateInCooldown = 0; + } + + if (AlternateSwings) + modplayer.swingNum = (modplayer.swingNum + 1) % 2; + } + + public override void AdditionalAI() + { + if (IsAlternateThrust) + { + if (inStartup) + { + trailFXTriggered = false; // Reset bool just in case + Projectile.Opacity += 0.01f; // Fade in + + // Pullback + float eased = MathF.Pow(StartupCompletion, 0.3f); + OffsetDistance = (int)MathHelper.Lerp(44, 34, eased); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.85f, eased); + + + if (!sparkTriggered && Projectile.scale < 0.96f) // Right before thrusting forward + { + // Won't happen again this right-click + sparkTriggered = true; + + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.AntiqueWhite, Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) * 0.3f, 2f, 8, Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -0.25f : 0.25f), 1f); + GeneralParticleHandler.SpawnParticle(sparker); + } + } + + else if (inCooldown) + { + Projectile.Opacity -= 0.0135f; + + // During cooldown, pull back slightly + Projectile.scale = baseScale * MathHelper.Lerp(1.6f, 1.55f, CooldownCompletion); + OffsetDistance = (int)MathHelper.Lerp(68, 42, CooldownCompletion); + } + + else if (inSwing) + { + // Thrust forward + OffsetDistance = (int)MathHelper.Lerp(34, 68, SwingCompletion); + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 3.5f; + + // Scaling adjustments + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var eased = MathF.Pow(t, 0.125f); + Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 1.6f, eased); + + // VFX vars + Player player = Main.player[Projectile.owner]; + Vector2 mousePosition = Main.MouseWorld; + Vector2 fireDirection = Vector2.Normalize(mousePosition - player.Center); + + // Fire the bigass projectile + if (!trailFXTriggered) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0f, 0f); + + SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); + SoundEngine.PlaySound(swish with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(projectile with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.15f, 0.2f) }, Projectile.Center); + } + + trailFXTriggered = true; + + // Some sparks from the blade + if (!particlesSpawned) + { + for (int i = 0; i < 6; i++) + { + Vector2 particleOrigin = Projectile.Center; + Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + GeneralParticleHandler.SpawnParticle(sparks); + } + particlesSpawned = true; + } + + } + } + + else // Primary + { + if (inStartup) + { + AfterImageLength = 0; + + Projectile.Opacity += 0.01f; // Fade in + gotEnergyThisSwing = false; + helixFired = false; + Projectile.scale = baseScale * MathHelper.Lerp(0.625f, 0.8f, StartupCompletion); + } + + else if (inCooldown) + { + AfterImageLength = 0; + + helixFired = false; + Projectile.Opacity -= 0.09f; + Projectile.scale = baseScale * MathHelper.Lerp(0.85f, 0.625f, CooldownCompletion); + } + + else if (inSwing) + { + if (!helixFired) + { + helixFired = true; + var player = Main.player[Projectile.owner]; + var mousePosition = Main.MouseWorld; + var fireDirection = Vector2.Normalize(mousePosition - player.Center); + var helixSpeed = 12f; + var helixVelocity = fireDirection * helixSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); + SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + AfterImageLength = 30; + + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var parabola = 1f - MathF.Pow(t - 0.5f, 2f) * 4f; + OffsetDistance = (int)MathHelper.Lerp(36 * 1f, 36 * 1.435f, parabola); + var upPhase = t <= 0.5f ? t / 0.5f : (1f - t) / 0.5f; + var eased = MathF.Pow(upPhase, 2.6f); + Projectile.scale = baseScale * MathHelper.Lerp(0.8f, 1.4f, eased); + + } + } + base.AdditionalAI(); + } + + public override float SwingFunction() + { + var player = Main.player[Projectile.owner]; + + if (IsAlternateThrust) + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + + if (inStartup) + { + return 0f; + } + + if (timer < StartupTime + swingTime) + { + return 0f; + } + + else + return 0f; // Just retract and fade out without moving the angle + } + + else // Primary swing + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + if (modplayer.swingNum == 1) + swingDirection *= -1; + + var parabolicFactorPrimary = 1f - MathF.Pow(SwingCompletion - 0.5f, 2f) * 4f; + parabolicFactorPrimary = MathHelper.Clamp(parabolicFactorPrimary, 0f, 1f); + Projectile.localAI[0] = parabolicFactorPrimary; + + var startAnglePrimary = -swingWidth / 2.15f; + var endAnglePrimary = swingWidth / 2.15f; + var trueAnglePrimary = MathHelper.Lerp(startAnglePrimary, endAnglePrimary, SwingCompletion); + + return MathHelper.ToRadians(trueAnglePrimary * -swingDirection); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Add energy for the primary attack + if (!IsAlternateThrust && !gotEnergyThisSwing) + { + gotEnergyThisSwing = true; + var player = Main.player[Projectile.owner]; + var modPlayer = player.Calamity(); + + // +22 energy on hit + modPlayer.lucreciaEnergy += 22; + modPlayer.lucreciaEnergy = Math.Min(modPlayer.lucreciaEnergy, Lucrecia.MaxEnergy); + + // On-hit cut FX + int points = 2; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + + var modplayer = player.GetModPlayer(); + Color useColor = modplayer.swingNum == 1 ? Color.CornflowerBlue : Color.MediumPurple; // Alternate each swing + + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 9, 0.05f, useColor, new Vector2(0.5f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Draw fullbright + lightColor = Color.White; + return base.PreDraw(ref lightColor); + } + } +} diff --git a/Projectiles/Melee/LucreciaSmallProjectile.cs b/Projectiles/Melee/LucreciaSmallProjectile.cs new file mode 100644 index 0000000000..f972eb300a --- /dev/null +++ b/Projectiles/Melee/LucreciaSmallProjectile.cs @@ -0,0 +1,158 @@ +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaSmallProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int TargetIndex = -1; + + public static float MaxWidth = 30; + public ref float Time => ref Projectile.ai[0]; + + public static Asset BloomTex; + public static Asset SlashTex; + public static Asset TrailTex; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 13; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 19; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 420; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + // Little bit of ambient lighting as it travels + Lighting.AddLight(Projectile.Center, Color.WhiteSmoke.ToVector3() * 0.4f); + + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity *= 1.01f; + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + if (Projectile.FinalExtraUpdate()) + Time++; + + // CRUCIAL so that oldPos isnt initialized incorrectly when drawing + if (Projectile.localAI[0] == 0f) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Projectile.oldPos[i] = Projectile.position; + } + Projectile.localAI[0] = 1f; + } + } + + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + for (int i = 0; i < 6; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(1.2f, 1.6f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, Main.rand.NextFloat(0f, 1f)); + } + } + + public override void OnKill(int timeLeft) + { + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltImpact"); + SoundEngine.PlaySound(projectile with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) with { A = 0 } * Projectile.Opacity; + + public float TrailWidth(float completionRatio) + { + float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + + width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + return width * (MaxWidth * .265f); + } + public Color TrailColor(float completionRatio) + { + Color baseColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + return baseColor * 0.2f; + } + + public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 5.5f; + public Color MiniTrailColor(float completionRatio) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 412) + return false; + + Color mainColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f) % 1); + Color secondaryColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1); + + Main.spriteBatch.EnterShaderRegion(); + + if (TrailTex == null) + TrailTex = Request("CalamityMod/ExtraTextures/Trails/BasicTrail"); + + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + + Vector2 offset = Projectile.Size * 0.5f; + + // Apply the offset to the projectile's old position + Vector2[] oldPosWithOffset = Projectile.oldPos.Select(p => p - offset).ToArray(); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(TrailWidth, TrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs deleted file mode 100644 index 2517332b34..0000000000 --- a/Projectiles/Melee/Shortswords/LucreciaProj.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee.Shortswords -{ - public class LucreciaProj : BaseShortswordProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 28; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.ownerHitCheck = true; - Projectile.timeLeft = 360; - Projectile.hide = true; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - } - - public override Action EffectBeforePullback => (proj) => - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - }; - - - public override void SetVisualOffsets() - { - const int HalfSpriteWidth = 62 / 2; - const int HalfSpriteHeight = 62 / 2; - - int HalfProjWidth = Projectile.width / 2; - int HalfProjHeight = Projectile.height / 2; - - DrawOriginOffsetX = 0; - DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); - DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); - } - - public override void ExtraBehavior() - { - if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); - } - } -} diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index a2d0eedeeb..4e1a34b204 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged private SlotId NorfleetRecharge; private ref float OffsetLength => ref Projectile.localAI[0]; - private ref float loadedShots => ref Projectile.ai[2]; private Player Owner; @@ -92,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged { hum?.Stop(); } - if (loadedShots > 1) + if (Owner.Calamity().NorfleetCounter < 2) { ShootRocket(heldItem); PostFireCooldown = PUNISHMENTMODE ? 1000 : 55; @@ -191,6 +190,7 @@ namespace CalamityMod.Projectiles.Ranged // Spawns the projectile. SoundStyle fire = new("CalamityMod/Sounds/Item/NorfleetFire"); SoundEngine.PlaySound(fire with { Volume = 0.9f, PitchVariance = 0.25f }, Projectile.Center); + Owner.Calamity().NorfleetCounter++; for (int i = 0; i < 3; i++) { @@ -328,6 +328,12 @@ namespace CalamityMod.Projectiles.Ranged { Owner = Main.player[Projectile.owner]; OffsetLength = MaxOffsetLength; + + if (Main.zenithWorld && Main.rand.NextBool(1000)) + { + PUNISHMENTMODE = true; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/NuhUhUh"), Owner.Center); + } } // Because we use the velocity as a direction, we don't need it to change its position. diff --git a/Projectiles/Typeless/PauldronDash.cs b/Projectiles/Typeless/PauldronDash.cs index efc5b8021d..c9e6c42619 100644 --- a/Projectiles/Typeless/PauldronDash.cs +++ b/Projectiles/Typeless/PauldronDash.cs @@ -80,7 +80,9 @@ namespace CalamityMod.Projectiles.Typeless if (visuals) { int dir = MathF.Sign(aimVel.X); - Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + if (dir == 0) + dir = Owner.direction; + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX * dir); float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); for (int i = -1; i <= 1; i += 2) { @@ -100,7 +102,7 @@ namespace CalamityMod.Projectiles.Typeless } } - if (Owner.dead || (!isAlive && fxFade < 0.1f) || Owner.velocity == Vector2.Zero) + if (Owner.dead || (!isAlive && fxFade < 0.1f) || (Owner.velocity == Vector2.Zero && Owner.dashDelay != -1)) Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index a602acf9bd..5c4a83a9a4 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -52,9 +52,6 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (!BreakApart) - lastDir = Owner.direction; - float intendedScale = 0.85f; float spawnAnimTime = 12 + wingNum; if (time == 0) @@ -267,6 +264,11 @@ namespace CalamityMod.Projectiles.Typeless time++; } } + public override void PostDraw(Color lightColor) + { + if (!BreakApart) + lastDir = Owner.direction; + } public override bool PreDraw(ref Color lightColor) { float topWingNum = (checkActiveWings() - 1); diff --git a/Sounds/Item/LucreciaBoltFire.ogg b/Sounds/Item/LucreciaBoltFire.ogg new file mode 100644 index 0000000000..1f189852b1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltFire.ogg differ diff --git a/Sounds/Item/LucreciaBoltImpact.ogg b/Sounds/Item/LucreciaBoltImpact.ogg new file mode 100644 index 0000000000..ca55683cf1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltImpact.ogg differ diff --git a/Sounds/Item/ShrimpFire.ogg b/Sounds/Item/ShrimpFire.ogg new file mode 100644 index 0000000000..b60d95c9aa Binary files /dev/null and b/Sounds/Item/ShrimpFire.ogg differ diff --git a/Sounds/Item/ShrimpMissileHit.ogg b/Sounds/Item/ShrimpMissileHit.ogg new file mode 100644 index 0000000000..c34fcac6cf Binary files /dev/null and b/Sounds/Item/ShrimpMissileHit.ogg differ diff --git a/Sounds/Item/ShrimpSound1.ogg b/Sounds/Item/ShrimpSound1.ogg new file mode 100644 index 0000000000..38d7eae4ea Binary files /dev/null and b/Sounds/Item/ShrimpSound1.ogg differ diff --git a/Sounds/Item/ShrimpSound2.ogg b/Sounds/Item/ShrimpSound2.ogg new file mode 100644 index 0000000000..f8106c6edf Binary files /dev/null and b/Sounds/Item/ShrimpSound2.ogg differ diff --git a/Sounds/Item/ShrimpSurprise.ogg b/Sounds/Item/ShrimpSurprise.ogg new file mode 100644 index 0000000000..5eb8fbad6d Binary files /dev/null and b/Sounds/Item/ShrimpSurprise.ogg differ diff --git a/en-US.hjson b/en-US.hjson new file mode 100644 index 0000000000..a95d61a6de --- /dev/null +++ b/en-US.hjson @@ -0,0 +1 @@ +Mods.CalamityMod.Projectiles.LucreciaDNATrailCreator.DisplayName: Lucrecia D N A Trail Creator