diff --git a/Buffs/Pets/FrostyBatBuff.cs b/Buffs/Pets/FrostyBatBuff.cs new file mode 100644 index 0000000000..b7a6b73091 --- /dev/null +++ b/Buffs/Pets/FrostyBatBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class FrostyBatBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().frostyBat = true; + int proj = ModContent.ProjectileType(); + bool petProjectileNotSpawned = player.ownedProjectileCounts[proj] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, proj, 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/Summon/FrostbatBuff.png b/Buffs/Pets/FrostyBatBuff.png similarity index 100% rename from Buffs/Summon/FrostbatBuff.png rename to Buffs/Pets/FrostyBatBuff.png diff --git a/Buffs/Pets/ToastyBatBuff.cs b/Buffs/Pets/ToastyBatBuff.cs new file mode 100644 index 0000000000..c81630f94e --- /dev/null +++ b/Buffs/Pets/ToastyBatBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class ToastyBatBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().toastyBat = true; + int proj = ModContent.ProjectileType(); + bool petProjectileNotSpawned = player.ownedProjectileCounts[proj] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, proj, 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/Summon/FlarebatBuff.png b/Buffs/Pets/ToastyBatBuff.png similarity index 100% rename from Buffs/Summon/FlarebatBuff.png rename to Buffs/Pets/ToastyBatBuff.png diff --git a/Buffs/Summon/FlarebatBuff.cs b/Buffs/Summon/FlarebatBuff.cs deleted file mode 100644 index 7be2c4732c..0000000000 --- a/Buffs/Summon/FlarebatBuff.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class FlarebatBuff : BaseSummonBuff - { - protected override int MinionProjectileType => ModContent.ProjectileType(); - - protected override ref bool MinionBool => ref BuffModdedOwner.FlarebatBool; - } -} diff --git a/Buffs/Summon/FrostbatBuff.cs b/Buffs/Summon/FrostbatBuff.cs deleted file mode 100644 index 6bc6421c8d..0000000000 --- a/Buffs/Summon/FrostbatBuff.cs +++ /dev/null @@ -1,12 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class FrostbatBuff : BaseSummonBuff - { - protected override int MinionProjectileType => ModContent.ProjectileType(); - - protected override ref bool MinionBool => ref BuffModdedOwner.FrostbatBool; - } -} diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a07e74c8a3..e8b0e7de9c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -82,6 +82,7 @@ using Terraria.ModLoader.IO; using Terraria.Net; using static Terraria.Main; using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Pets; namespace CalamityMod.CalPlayer { @@ -297,6 +298,10 @@ namespace CalamityMod.CalPlayer public bool lucreciaEnergyPaused = false; public bool lucreciaEnergyMaxSFXPlayed = false; private int lucreciaParticleTimer = 0; + public int elementalMastery = 0; + public int elementalMasteryTimer = 0; + public bool elementalMasteryPaused = false; + public bool elementalMasterySFXPlayed = false; public float unstableCastersGauntletVis = 0; public int unstableCastersGauntletVisTimer = 0; public int PhotoAudioCooldown = 0; @@ -547,6 +552,8 @@ namespace CalamityMod.CalPlayer public bool pineapplePet = false; public bool eidolonSnailPet = false; public bool lordePet = false; + public bool frostyBat = false; + public bool toastyBat = false; #endregion #region Rage @@ -1567,8 +1574,6 @@ namespace CalamityMod.CalPlayer public bool KalandraMirror = false; public bool StellarTorus = false; public bool LiliesOfFinalityBool = false; - public bool FlarebatBool = false; - public bool FrostbatBool = false; public bool AmphibiansGuitarBool = false; #endregion @@ -2128,6 +2133,8 @@ namespace CalamityMod.CalPlayer pineapplePet = false; eidolonSnailPet = false; lordePet = false; + frostyBat = false; + toastyBat = false; onyxExcavator = false; rimehound = false; @@ -2734,8 +2741,6 @@ namespace CalamityMod.CalPlayer KalandraMirror = false; StellarTorus = false; LiliesOfFinalityBool = false; - FlarebatBool = false; - FrostbatBool = false; AmphibiansGuitarBool = false; #endregion @@ -3263,6 +3268,7 @@ namespace CalamityMod.CalPlayer flareGunOverheat = 0; hellbornShots = 0; lucreciaEnergy = 0; + elementalMastery = 0; garandShots = 0; searedPanCounter = 0; searedPanTimer = 0; @@ -5217,6 +5223,13 @@ namespace CalamityMod.CalPlayer private void NOULOL() { Player.ResetEffects(); + for (int j = 0; j < 1000; j++) + { + if (!Main.projectile[j].active || Main.projectile[j].owner != Player.whoAmI) + continue; + + Player.ownedProjectileCounts[Main.projectile[j].type]++; + } Player.head = -1; Player.body = -1; Player.legs = -1; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 46f3100734..acfa24e1ac 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -61,6 +61,7 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Pets; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -167,7 +168,7 @@ namespace CalamityMod.CalPlayer UpdateDrawingParameters(); // Handle Lucrecia's passive energy effects - HandleLucreciaEffects(); + HandleLucreciaLineEffects(); // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced @@ -200,6 +201,17 @@ namespace CalamityMod.CalPlayer if (Player.ActiveItem().type != ModContent.ItemType()) saharaSlicersBolts = 0; + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) + { + int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + } + if (Player.whoAmI == Main.myPlayer && Player.HeldItem.type == ModContent.ItemType() && (Player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) && !Player.dead) + { + int damage = (int)Player.GetTotalDamage().ApplyTo(Player.HeldItem.damage); + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType(), damage, Player.HeldItem.knockBack, Player.whoAmI); + } + // De-equipping Gael's Greatsword deletes all rage. if (Player.ActiveItem().type == ModContent.ItemType()) heldGaelsLastFrame = true; @@ -414,9 +426,56 @@ namespace CalamityMod.CalPlayer } else { - // Reset the timer and pause state if the player isn't holding the weapon. + // Reset all energy variables when not holding the weapon lucreciaEnergyTimer = 0; lucreciaEnergyPaused = false; + lucreciaEnergy = 0; + } + + if (Player.HeldItem.type == ModContent.ItemType() && elementalMastery > 0) + { + if (elementalMastery == Lightspeed.MaxEnergy && !elementalMasteryPaused) + { + elementalMasteryPaused = true; + elementalMasteryTimer = 0; + } + + elementalMasteryTimer++; + + // If the mastery is at max, pause for 180 ticks + if (elementalMasteryPaused) + { + if (elementalMasteryTimer >= 1 && !elementalMasterySFXPlayed) + { + SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center); + elementalMasterySFXPlayed = true; + + } + // If the pause is Done, resume decrementing. + if (elementalMasteryTimer >= 180) + { + elementalMasteryPaused = false; + elementalMasteryTimer = 0; + elementalMastery--; + } + } + else // Decrementing + { + elementalMasterySFXPlayed = false; + // Once every 20 ticks + if (elementalMasteryTimer >= 20) + { + elementalMastery--; + elementalMasteryTimer = 0; + } + } + } + else + { + // Reset all EM variables when not holding the weapon + elementalMasteryTimer = 0; + elementalMasteryPaused = false; + elementalMastery = 0; } @@ -4483,11 +4542,13 @@ namespace CalamityMod.CalPlayer } #endregion - #region Lucrecia Effects + #region Lucrecia Line Effects - public void HandleLucreciaEffects() + public void HandleLucreciaLineEffects() { int lucreciaItemID = ModContent.ItemType(); + int lightspeedItemID = ModContent.ItemType(); + if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 0) { lucreciaParticleTimer--; @@ -4516,7 +4577,40 @@ namespace CalamityMod.CalPlayer 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); + var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color with { A = 0 }, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI); + GeneralParticleHandler.SpawnParticle(particle); + } + } + + if (Player.HeldItem.type == lightspeedItemID && elementalMastery > 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 * (elementalMastery / 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 = elementalMastery / (float)Lightspeed.MaxEnergy; + Color color = Main.rand.NextBool() ? Color.Aqua : Color.OrangeRed; + color *= opacity; + + if (elementalMastery >= 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 with { A = 0 }, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI); GeneralParticleHandler.SpawnParticle(particle); } } diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index 4f83deabb8..1a78ff7ad7 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -89,8 +89,8 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/StarburstShivGlow").Value; + else if (itemType == ModContent.ItemType()) + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/LightspeedGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value; else if (itemType == ModContent.ItemType()) diff --git a/Cooldowns/ElementalMastery.cs b/Cooldowns/ElementalMastery.cs new file mode 100644 index 0000000000..4b9c5d73c2 --- /dev/null +++ b/Cooldowns/ElementalMastery.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 ElementalMastery : CooldownHandler + { + private float AdjustedCompletion => instance.timeLeft / (float) Lightspeed.MaxEnergy; + private Color TextColor => Color.AliceBlue; + private Color TextBorderColor = Color.AntiqueWhite; + + public static new string ID => "ElementalMastery"; + 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.OrangeRed, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.AliceBlue, 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/ElementalMastery.png b/Cooldowns/ElementalMastery.png new file mode 100644 index 0000000000..fb98df7f28 Binary files /dev/null and b/Cooldowns/ElementalMastery.png differ diff --git a/Cooldowns/ElementalMasteryOutline.png b/Cooldowns/ElementalMasteryOutline.png new file mode 100644 index 0000000000..775f2540bb Binary files /dev/null and b/Cooldowns/ElementalMasteryOutline.png differ diff --git a/Cooldowns/ElementalMasteryOverlay.png b/Cooldowns/ElementalMasteryOverlay.png new file mode 100644 index 0000000000..d52f950391 Binary files /dev/null and b/Cooldowns/ElementalMasteryOverlay.png differ diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index af1924434d..8c509e7aaf 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -151,8 +151,7 @@ namespace CalamityMod.Events DownedBossSystem.startedBossRushAtLeastOnce = true; }, permittedNPCs: new int[] { NPCID.BlueSlime, NPCID.YellowSlime, NPCID.PurpleSlime, NPCID.RedSlime, NPCID.GreenSlime, NPCID.RedSlime, - NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType(), - ModContent.NPCType(), ModContent.NPCType() }), + NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType()}), new Boss(ModContent.NPCType(), spawnContext: type => { diff --git a/ExtraTextures/SimpleStar.png b/ExtraTextures/SimpleStar.png new file mode 100644 index 0000000000..15fe40013a Binary files /dev/null and b/ExtraTextures/SimpleStar.png differ diff --git a/Graphics/Metaballs/StarsmokeBlueLayer.png b/Graphics/Metaballs/StarsmokeBlueLayer.png new file mode 100644 index 0000000000..77691f5acd Binary files /dev/null and b/Graphics/Metaballs/StarsmokeBlueLayer.png differ diff --git a/Graphics/Metaballs/StarsmokeLayer.png b/Graphics/Metaballs/StarsmokeLayer.png new file mode 100644 index 0000000000..8b14723cbc Binary files /dev/null and b/Graphics/Metaballs/StarsmokeLayer.png differ diff --git a/Graphics/Metaballs/StarsmokeMetaball.cs b/Graphics/Metaballs/StarsmokeMetaball.cs new file mode 100644 index 0000000000..e5f2565257 --- /dev/null +++ b/Graphics/Metaballs/StarsmokeMetaball.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Graphics.Metaballs +{ + public class StarsmokeMetaball : Metaball + { + public Color borderColor = Color.Purple; + public Vector2 goalDir = Vector2.Zero; + public Vector2 scrollDir = Vector2.Zero; + public class StarsmokeParticle + { + public float Size; + + public Vector2 Velocity; + + public Vector2 Center; + public Vector2 BaseSquash = Vector2.One; + public float Rotation; + public float ShrinkSpeed = 0; + public int Lifetime; + public float SquashPower = 0; + public int time = 0; + + public StarsmokeParticle(Vector2 center, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0) + { + Center = center; + Velocity = velocity; + Size = size; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + BaseSquash = squash; + Lifetime = lifetime; + ShrinkSpeed = shrinkSpeed; + SquashPower = velocitySquash; + } + + public void Update() + { + float sine = (float)Math.Sin(time * 0.15f * SquashPower) * 0.8f; + Center += Velocity; + Velocity *= 0.96f; + Velocity += Velocity.RotatedBy(0.36f * sine * SquashPower * (Math.Sign(ShrinkSpeed))) * 0.02f; + if ((float)time / (float)Lifetime > 0.8f) + { + Size *= 0.9f; + } + BaseSquash.X *= (1 - 0.2f * ShrinkSpeed); + BaseSquash.Y *= (1 + 0.2f * ShrinkSpeed); + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + } + public static Asset LayerAsset + { + get; + private set; + } + + public static List Particles + { + get; + private set; + } = new(); + + public override bool AnythingToDraw => Particles.Any(); + + public override IEnumerable Layers + { + get + { + yield return LayerAsset.Value; + } + } + + public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override void Load() + { + if (Main.dedServ) + return; + + // Load the layer asset wrapper. + LayerAsset = ModContent.Request($"CalamityMod/Particles/GlowSquareParticleBig", AssetRequestMode.ImmediateLoad); + } + + public override void Update() + { + if (goalDir == Vector2.Zero) + goalDir = Vector2.One.RotatedByRandom(Math.PI); + if ((int)(Main.GlobalTimeWrappedHourly * 50) % 5 == 0) + { + goalDir = goalDir.RotatedByRandom(0.13f); + } + scrollDir = Vector2.Lerp(scrollDir, goalDir, 0.01f); + + float rate = Main.GlobalTimeWrappedHourly * 19; + List colors = new List() + { + new Color (192, 10, 111), + Color.Coral, + Color.DarkOrange + }; + + int colorIndex = (int)(rate / 2 % colors.Count); + Color currentColor = colors[colorIndex]; + Color nextColor = colors[(colorIndex + 1) % colors.Count]; + borderColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // Update all particle instances. + // Once sufficiently small, they vanish. + for (int i = 0; i < Particles.Count; i++) + Particles[i].Update(); + Particles.RemoveAll(p => p.Size <= 2f); + } + public override Color EdgeColor => borderColor with { A = 0 } * 0.3f; + + public static void SpawnParticle(Vector2 position, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0) => + Particles.Add(new(position, velocity, size, lifetime, squash, shrinkSpeed, velocitySquash)); + + // Make the texture scroll. + public override Vector2 CalculateManualOffsetForLayer(int layerIndex) + { + return scrollDir * 0.5f; + } + + public override void DrawInstances() + { + Texture2D tex = ModContent.Request("CalamityMod/Graphics/Metaballs/StarsmokeMetaball2").Value; + + foreach (StarsmokeParticle particle in Particles) + { + float sine = (float)Math.Sin(particle.time * 0.2f) * 0.5f; + float lifetimeVal = 1 - (particle.time / particle.Lifetime); + Vector2 altSquash = new Vector2(1f + 1 * (1 + sine) * lifetimeVal, 1f + 1 * (1 - sine) * lifetimeVal); + Vector2 squash = Vector2.Lerp(particle.BaseSquash, new Vector2(Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 2.5f)), particle.SquashPower); + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = tex.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / tex.Size(); + Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, particle.Rotation, origin, squash * scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Graphics/Metaballs/StarsmokeMetaball1.png b/Graphics/Metaballs/StarsmokeMetaball1.png new file mode 100644 index 0000000000..522a9295d6 Binary files /dev/null and b/Graphics/Metaballs/StarsmokeMetaball1.png differ diff --git a/Graphics/Metaballs/StarsmokeMetaball2.png b/Graphics/Metaballs/StarsmokeMetaball2.png new file mode 100644 index 0000000000..ed5443bca0 Binary files /dev/null and b/Graphics/Metaballs/StarsmokeMetaball2.png differ diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 25c3d2c67a..17e80af4b1 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -207,7 +207,10 @@ namespace CalamityMod.ILEditing IL_WorldGen.AttemptFossilShattering += PreventFossilShattering; On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement; IL_Player.Update += PreventUFODismountInWater; - On_Player.GetAnglerReward += ImproveAnglerRewards; + + On_Player.GetAnglerReward_MainReward += AddMoreGuaranteedAnglerRewards; + On_Player.GetAnglerReward_Bait += ImproveAnglerBaitReward; + On_Player.GetAnglerReward_Money += ImproveAnglerMoneyReward; IL_Player.TileInteractionsUse += RemovePowerCellPlanteraLock; On_Player.ItemCheck_CheckCanUse += RemoveUseLocks; @@ -220,10 +223,6 @@ namespace CalamityMod.ILEditing On_Main.DrawPlayerChatBubbles += UI_Unflip_Start; On_Main.DrawInterface += UI_Unflip_End; - // Fix vanilla bugs exposed by Calamity mechanics - IL_NPC.NPCLoot += FixSplittingWormBannerDrops; - On_NPC.PlayerInteraction += FixSplittingWormInteraction; - // Fix vanilla not accounting for spritebatch modification in held projectile drawing On_PlayerDrawLayers.DrawHeldProj += FixHeldProjectileBlendState; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index c37d030846..5a28523942 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1831,7 +1831,7 @@ namespace CalamityMod.ILEditing droids.velocity = -self.velocity.RotatedByRandom(MathHelper.Pi / 20f) * 2f; droids.netUpdate = true; droids.shimmerTransparency = 1f; - NetMessage.SendData(146, -1, -1, null, 2, droids.whoAmI); + NetMessage.SendData(MessageID.ShimmerActions, -1, -1, null, 2, droids.whoAmI); } self.TurnToAir(); @@ -1844,8 +1844,8 @@ namespace CalamityMod.ILEditing } else { - NetMessage.SendData(146, -1, -1, null, 0, (int)self.Center.X, (int)self.Center.Y); - NetMessage.SendData(145, -1, -1, null, self.whoAmI, 1f); + NetMessage.SendData(MessageID.ShimmerActions, -1, -1, null, 0, (int)self.Center.X, (int)self.Center.Y); + NetMessage.SendData(MessageID.SyncItemsWithShimmer, -1, -1, null, self.whoAmI, 1f); } } } diff --git a/ILEditing/VanillaBugfixingILChanges.cs b/ILEditing/VanillaBugfixingILChanges.cs index 69df735490..23b271f586 100644 --- a/ILEditing/VanillaBugfixingILChanges.cs +++ b/ILEditing/VanillaBugfixingILChanges.cs @@ -12,52 +12,6 @@ namespace CalamityMod.ILEditing { public partial class ILChanges { - #region Fixing Splitting Worm Banner Spam in Deathmode - // CONTEXT FOR FIX: In Death Mode, normal worms are capable of splitting similarly to the Eater of Worlds. This, as expected, comes with problems with loot dropping, as you can kill multiple - // head segments from the same original worm. TML allows us to safely handle this with its drop hooks. Unfortunately, however, this does not apply to banner dropping logic based on total kills or - // for bestiary registrations. - // As such, we must IL Edit the vanilla drop method to stop it from registering kills based on worms that can still be split. This references the same blocking logic as the aforementioned hooks. - private static void FixSplittingWormBannerDrops(ILContext il) - { - var cursor = new ILCursor(il); - - // Find the first return in the method. This will be marked as a label to jump to if the splitting loot check is failed, effectively terminating any and all - // loot code, including banners and bestiary stuff. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchRet())) - { - LogFailure("Splitting worm banner spam fix", "Could not locate the first method return."); - } - - // Save the ret as a place to return to. - ILLabel ret = cursor.MarkLabel(); - - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(0))) - { - LogFailure("Splitting worm banner spam fix", "Could not locate the closest player storage."); - return; - } - - // Load the NPC caller onto the stack. - cursor.Emit(OpCodes.Ldarg_0); - cursor.EmitDelegate>(npc => CalamityGlobalNPC.SplittingWormLootBlockWrapper(npc, CalamityMod.Instance)); - - // If the block is false (indicating the drop logic should stop), return the method early. - cursor.Emit(OpCodes.Brfalse, ret); - } - #endregion Fixing Splitting Worm Banner Spam in Deathmode - - #region Fixing Splitting Worm Interaction in Deathmode - // CONTEXT FOR FIX: In Death Mode, normal worms are capable of splitting similarly to the Eater of Worlds. This comes with problems with bestiary entries. The entries are incremented only when - // the killed npc is the head segment and it has been interacted at least once. These two conditions may be violated because NPC.NPCLoot only triggers once because of the above fix. - // The fix for former condition is in CalamityGlobalNPCLoot.OnKill. For the latter condition, NPC.PlayerInteraction should broadcast interaction to every other worm segments. - // This is already done for vanilla worm enemies like EOW. - private static void FixSplittingWormInteraction(On_NPC.orig_PlayerInteraction orig, NPC npc, int player) - { - orig(npc, player); - CalamityGlobalNPC.SplittingWormBroadcastInteractionWrapper(npc, player); - } - #endregion - #region Fixing Vanilla Not Accounting For Spritebatch Modification in Held Projectiles private static bool HasLoggedHeldProjectileBlendStateCatch = false; private void FixHeldProjectileBlendState(On_PlayerDrawLayers.orig_DrawHeldProj orig, PlayerDrawSet drawinfo, Projectile proj) diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index cc0f5ccb85..e00fff3ba6 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -436,628 +436,134 @@ namespace CalamityMod.ILEditing #endregion Color Blighted Gel #region Improve Angler Quest Rewards - private static void ImproveAnglerRewards(On_Player.orig_GetAnglerReward orig, Player self, NPC angler, int questItemType) + private static void AddMoreGuaranteedAnglerRewards(On_Player.orig_GetAnglerReward_MainReward orig, Player self, List rewardItems, IEntitySource source, int questsDone, float rarityReduction, int questItemType, ref GetItemSettings anglerRewardSettings) { - orig(self, angler, questItemType); - - EntitySource_Gift source = new EntitySource_Gift(angler); - int questsDone = self.anglerQuestsFinished; - float rarityReduction = 1f; - rarityReduction = (questsDone <= 50) ? (rarityReduction - questsDone * 0.01f) : ((questsDone <= 100) ? (0.5f - (questsDone - 50) * 0.005f) : ((questsDone > 150) ? 0.15f : (0.25f - (questsDone - 100) * 0.002f))); - rarityReduction *= 0.9f; - rarityReduction *= (float)(self.currentShoppingSettings.PriceAdjustment + 1.0) / 2f; - - if (rarityReduction < 0.1f) - rarityReduction = 0.1f; - - List rewardItems = new List(); - - GetItemSettings anglerRewardSettings = GetItemSettings.NPCEntityToPlayerInventorySettings; - + // Adds several new guaranteed rewards for specific quests. + // These will replace the item that would have dropped via vanilla logic. Item item = new Item(); + item.type = ItemID.None; + List checkingList = []; - // GUARANTEED REWARDS - - // BAIT switch (questsDone) { - case 0: - case 1: - case 2: - case 3: - case 4: - item = new Item(); - item.SetDefaults(ItemID.Stinkbug); - item.stack = Main.rand.Next(2, 6); + case 3: // High Test Fishing Line + checkingList.Add(ItemID.HighTestFishingLine); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int highTest)) + item.SetDefaults(highTest); break; - - case 5: - case 6: - case 7: - case 8: - case 9: - item = new Item(); - item.SetDefaults(ItemID.ApprenticeBait); - item.stack = Main.rand.Next(2, 6); + case 6: // Fisherman's Pocket Guide + checkingList.Add(ItemID.FishermansGuide); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int fishGuide)) + item.SetDefaults(fishGuide); break; - - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - item = new Item(); - item.SetDefaults(Main.rand.NextBool() ? ItemID.Worm : ItemID.Maggot); - item.stack = Main.rand.Next(2, 6); + case 10: // Angler armor + Item vest = new Item(ItemID.AnglerVest); // Vanilla has a guaranteed reward for Angler Hat here. Calamity makes the other two pieces drop as well. + rewardItems.Add(vest); + Item pants = new Item(ItemID.AnglerPants); // This intentionally does not set the item variable, to allow vanilla logic to drop the Angler Hat. + rewardItems.Add(pants); break; - - case 16: - case 17: - case 18: - case 19: - case 20: - item = new Item(); - item.SetDefaults(ItemID.JourneymanBait); - item.stack = Main.rand.Next(2, 6); + case 11: // Weather Radio + checkingList.Add(ItemID.WeatherRadio); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int radio)) + item.SetDefaults(radio); break; - - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - item = new Item(); - item.SetDefaults(Main.rand.NextBool() ? ItemID.EnchantedNightcrawler : ItemID.Buggy); - item.stack = Main.rand.Next(2, 6); + case 14: // Sextant + checkingList.Add(ItemID.Sextant); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int sextant)) + item.SetDefaults(sextant); break; - - case 27: - case 28: - case 29: - case 30: - item = new Item(); - item.SetDefaults(ItemID.MasterBait); - item.stack = Main.rand.Next(2, 6); + case 15: // Tackle Box + checkingList.Add(ItemID.TackleBox); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int tackle)) + item.SetDefaults(tackle); break; - - default: - item = new Item(); - item.SetDefaults(ModContent.ItemType()); - item.stack = Main.rand.Next(2, 6); + case 20: // Angler Earring + checkingList.Add(ItemID.AnglerEarring); + if (self.DropAnglerAccByMissing(checkingList, 1f, out _, out int earring)) + item.SetDefaults(earring); break; - } - - item.position = self.Center; - Item item2 = self.GetItem(self.whoAmI, item, anglerRewardSettings); - rewardItems.Add(item2); - - // COINS - switch (questsDone) - { - case 0: - case 1: - case 2: - case 3: - case 4: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - break; - - case 5: - case 6: - case 7: - case 8: - case 9: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - item.stack = 2; - item = new Item(); - item.SetDefaults(ItemID.SilverCoin); - item.stack = 50; - break; - - case 10: - case 11: - case 12: - case 13: - case 14: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - item.stack = 4; - break; - - case 15: - case 16: - case 17: - case 18: - case 19: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - item.stack = 6; - break; - - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - item.stack = 8; - break; - - default: - item = new Item(); - item.SetDefaults(ItemID.GoldCoin); - item.stack = 10; - break; - } - - item.position = self.Center; - item2 = self.GetItem(self.whoAmI, item, anglerRewardSettings); - rewardItems.Add(item2); - - // PRIMARY ITEMS - switch (questsDone) - { - case 0: - case 1: - item = new Item(); - item.SetDefaults(ModContent.ItemType()); - rewardItems.Add(item); - break; - - case 2: - item = new Item(); - item.SetDefaults(ModContent.ItemType()); - item.stack = Main.rand.Next(4, 10); - rewardItems.Add(item); - break; - - case 3: - item = new Item(); - item.SetDefaults(ItemID.HighTestFishingLine); - rewardItems.Add(item); - break; - - case 4: - item = new Item(); - item.SetDefaults(ItemID.FishHook); - rewardItems.Add(item); - break; - - case 5: - item = new Item(); - item.SetDefaults(ItemID.FuzzyCarrot); - rewardItems.Add(item); - break; - - case 6: - item = new Item(); - item.SetDefaults(ItemID.FishermansGuide); - rewardItems.Add(item); - break; - - case 7: - item = new Item(); - item.SetDefaults(ItemID.FishCostumeMask); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.FishCostumeShirt); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.FishCostumeFinskirt); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ModContent.ItemType()); - rewardItems.Add(item); - break; - - case 8: - item = new Item(); - item.SetDefaults(ItemID.FishMinecart); - rewardItems.Add(item); - break; - - case 9: - item = new Item(); - item.SetDefaults(ItemID.SailfishBoots); - rewardItems.Add(item); - break; - - case 10: - item = new Item(); - item.SetDefaults(ItemID.AnglerHat); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.AnglerVest); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.AnglerPants); - rewardItems.Add(item); - break; - - case 11: - item = new Item(); - item.SetDefaults(ItemID.WeatherRadio); - rewardItems.Add(item); - break; - - case 12: - item = new Item(); - item.SetDefaults(ItemID.FishingBobber); - rewardItems.Add(item); - break; - - case 13: - item = new Item(); - item.SetDefaults(ItemID.SeashellHairpin); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.MermaidAdornment); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.MermaidTail); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ModContent.ItemType()); - rewardItems.Add(item); - break; - - case 14: - item = new Item(); - item.SetDefaults(ItemID.Sextant); - rewardItems.Add(item); - break; - - case 15: - item = new Item(); - item.SetDefaults(ItemID.TackleBox); - rewardItems.Add(item); - break; - - case 16: - item = new Item(); - item.SetDefaults(ItemID.SuperAbsorbantSponge); - rewardItems.Add(item); - break; - - case 17: - item = new Item(); - item.SetDefaults(ItemID.LavaFishingHook); - rewardItems.Add(item); - break; - - case 18: - item = new Item(); - item.SetDefaults(ItemID.MagicConch); - rewardItems.Add(item); - break; - - case 19: - item = new Item(); - item.SetDefaults(ItemID.DemonConch); - rewardItems.Add(item); - break; - - case 20: - item = new Item(); - item.SetDefaults(ItemID.AnglerEarring); - rewardItems.Add(item); - break; - - case 21: - item = new Item(); - item.SetDefaults(ItemID.HoneyAbsorbantSponge); - rewardItems.Add(item); - break; - - case 22: - item = new Item(); - item.SetDefaults(ItemID.HotlineFishingHook); - rewardItems.Add(item); - break; - - case 23: - item = new Item(); - item.SetDefaults(ItemID.FrogLeg); - rewardItems.Add(item); - break; - - case 24: - item = new Item(); - item.SetDefaults(ItemID.SuperheatedBlood); - rewardItems.Add(item); - break; - - case 25: - item = new Item(); - item.SetDefaults(ItemID.BottomlessBucket); - rewardItems.Add(item); - break; - - case 26: - item = new Item(); + case 26: // Enchanted Sundial item.SetDefaults(ItemID.Sundial); - rewardItems.Add(item); break; - - case 27: - item = new Item(); - item.SetDefaults(ItemID.BottomlessHoneyBucket); - rewardItems.Add(item); - break; - - case 28: - item = new Item(); + case 28: // Golden Bug Net item.SetDefaults(ItemID.GoldenBugNet); - rewardItems.Add(item); break; - - case 29: - item = new Item(); - item.SetDefaults(ItemID.BottomlessLavaBucket); - rewardItems.Add(item); - break; - - case 30: - item = new Item(); - item.SetDefaults(ItemID.GoldenFishingRod); - rewardItems.Add(item); + default: break; } - // RANDOM DROPS + // If the quest is of a number that gives a guaranteed reward from Calamity, add it to the reward pool and skip vanilla logic. + if (item.type > ItemID.None) + rewardItems.Add(item); + else + orig(self, rewardItems, source, questsDone, rarityReduction, questItemType, ref anglerRewardSettings); + } - // Angling Kits - if (Main.rand.NextBool((int)(12f * rarityReduction)) && questsDone > 30) + private static void ImproveAnglerBaitReward(On_Player.orig_GetAnglerReward_Bait orig, Player self, List rewardItems, IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings) + { + // Improves the bait reward given for Angler quests in three ways: + // 1. Makes bait reward be guaranteed. + // 2. Adds the ability for Grand Marquis Bait to be dropped. + // 3. Increases the amount of bait dropped. + // This entirely replaces the vanilla logic. + + Item bait = new Item(); + if (Main.rand.NextBool((int)(15f * rarityReduction))) + bait.SetDefaults(ModContent.ItemType()); + else if (Main.rand.NextBool((int)(10f * rarityReduction))) + bait.SetDefaults(ItemID.MasterBait); + else if (Main.rand.NextBool((int)(5f * rarityReduction))) + bait.SetDefaults(ItemID.JourneymanBait); + else + bait.SetDefaults(ItemID.ApprenticeBait); + + bait.stack = 2; + if (Main.rand.Next(10) <= questsDone) + bait.stack++; + if (Main.rand.Next(20) <= questsDone) + bait.stack++; + if (Main.rand.Next(30) <= questsDone) + bait.stack++; + if (Main.rand.Next(40) <= questsDone) + bait.stack++; + if (Main.rand.Next(50) <= questsDone) + bait.stack++; + + rewardItems.Add(bait); + } + + private static void ImproveAnglerMoneyReward(On_Player.orig_GetAnglerReward_Money orig, Player self, List rewardItems, IEntitySource source, int questsDone, float rarityReduction, ref GetItemSettings anglerRewardSettings) + { + // Improves the logic for giving money to the player from Angler quests. + // This is accomplished via a higher starting amount, reduced variance, and not truncating off Silver Coins if giving Gold Coins. + // This entirely replaces the vanilla logic. + + int moneyDrop = (questsDone + 70) / 2; // Vanilla uses 50 + moneyDrop = (int)(moneyDrop * Main.rand.NextFloat(1f, 2f)); // Vanilla is 0.75x-3x + moneyDrop = (int)(moneyDrop * 1.5f); // Vanilla then arbitrarily multiplies the value by 1.5x + if (Main.hardMode) + moneyDrop *= 2; + if (Main.expertMode) + moneyDrop *= 2; + if (moneyDrop > 1000) + moneyDrop = 1000; // Vanilla has a cap of 10 Gold Coins, or 1000 Silver Coins. + + // moneyDrop now contains the number of SILVER Coins to drop. + // Determine the number of Gold Coins to drop, if any. + if (moneyDrop >= 100) { - item = new Item(); - item.SetDefaults(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType()); - rewardItems.Add(item); - } - - // Golden Fishing Rod - if (Main.rand.NextBool((int)(500f * rarityReduction)) && questsDone > 30) - { - item = new Item(); - item.SetDefaults(ItemID.GoldenFishingRod); - rewardItems.Add(item); - } - - // Hotline Fishing Hook - if (Main.rand.NextBool((int)(200f * rarityReduction)) && questsDone > 22) - { - item = new Item(); - item.SetDefaults(ItemID.HotlineFishingHook); - rewardItems.Add(item); - } - - // Angler Set - if (Main.rand.NextBool((int)(150f * rarityReduction)) && questsDone > 10) - { - item = new Item(); - item.SetDefaults(ItemID.AnglerHat); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.AnglerVest); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.AnglerPants); - rewardItems.Add(item); - } - - // Mermaid Set - if (Main.rand.NextBool((int)(150f * rarityReduction)) && questsDone > 13) - { - item = new Item(); - item.SetDefaults(ItemID.SeashellHairpin); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.MermaidAdornment); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.MermaidTail); - rewardItems.Add(item); - } - - // Fish Set - if (Main.rand.NextBool((int)(150f * rarityReduction)) && questsDone > 7) - { - item = new Item(); - item.SetDefaults(ItemID.FishCostumeMask); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.FishCostumeShirt); - rewardItems.Add(item); - item = new Item(); - item.SetDefaults(ItemID.FishCostumeFinskirt); - rewardItems.Add(item); - } - - // Fin Wings - if (Main.rand.NextBool((int)(140f * rarityReduction)) && Main.hardMode && questsDone > 10) - { - item = new Item(); - item.SetDefaults(ItemID.FinWings); - rewardItems.Add(item); - } - - // Bottomless Water Bucket - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 25) - { - item = new Item(); - item.SetDefaults(ItemID.BottomlessBucket); - rewardItems.Add(item); - } - - // Bottomless Honey Bucket - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 27) - { - item = new Item(); - item.SetDefaults(ItemID.BottomlessHoneyBucket); - rewardItems.Add(item); - } - - // Bottomless Lava Bucket - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 29) - { - item = new Item(); - item.SetDefaults(ItemID.BottomlessLavaBucket); - rewardItems.Add(item); - } - - // Magic Conch - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 18) - { - item = new Item(); - item.SetDefaults(ItemID.MagicConch); - rewardItems.Add(item); - } - - // Demon Conch - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 19) - { - item = new Item(); - item.SetDefaults(ItemID.DemonConch); - rewardItems.Add(item); - } - - // Super Absorbant Sponge - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 16) - { - item = new Item(); - item.SetDefaults(ItemID.SuperAbsorbantSponge); - rewardItems.Add(item); - } - - // Honey Absorbant Sponge - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 21) - { - item = new Item(); - item.SetDefaults(ItemID.SuperAbsorbantSponge); - rewardItems.Add(item); - } - - // Golden Bug Net - if (Main.rand.NextBool((int)(140f * rarityReduction)) && questsDone > 28) - { - item = new Item(); - item.SetDefaults(ItemID.GoldenBugNet); - rewardItems.Add(item); - } - - // Fish Hook - if (Main.rand.NextBool((int)(120f * rarityReduction)) && questsDone > 4) - { - item = new Item(); - item.SetDefaults(ItemID.FishHook); - rewardItems.Add(item); - } - - // Minecarp - if (Main.rand.NextBool((int)(120f * rarityReduction)) && questsDone > 8) - { - item = new Item(); - item.SetDefaults(ItemID.FishMinecart); - rewardItems.Add(item); - } - - // Lava Shark - if (Main.rand.NextBool((int)(120f * rarityReduction)) && questsDone > 24) - { - item = new Item(); - item.SetDefaults(ItemID.SuperheatedBlood); - rewardItems.Add(item); - } - - // High Test Fishing Line - if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 3) - { - item = new Item(); - item.SetDefaults(ItemID.HighTestFishingLine); - rewardItems.Add(item); - } - - // Angler Earring - if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 20) - { - item = new Item(); - item.SetDefaults(ItemID.AnglerEarring); - rewardItems.Add(item); - } - - // Lavaproof Fishing Hook - if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 17) - { - item = new Item(); - item.SetDefaults(ItemID.LavaFishingHook); - rewardItems.Add(item); - } - - // Tackle Box - if (Main.rand.NextBool((int)(80f * rarityReduction)) && questsDone > 15) - { - item = new Item(); - item.SetDefaults(ItemID.TackleBox); - rewardItems.Add(item); - } - - // Fisherman's Pocket Guide - if (Main.rand.NextBool((int)(60f * rarityReduction)) && questsDone > 6) - { - item = new Item(); - item.SetDefaults(ItemID.FishermansGuide); - rewardItems.Add(item); - } - - // Weather Radio - if (Main.rand.NextBool((int)(60f * rarityReduction)) && questsDone > 11) - { - item = new Item(); - item.SetDefaults(ItemID.WeatherRadio); - rewardItems.Add(item); - } - - // Sextant - if (Main.rand.NextBool((int)(60f * rarityReduction)) && questsDone > 14) - { - item = new Item(); - item.SetDefaults(ItemID.Sextant); - rewardItems.Add(item); - } - - // Fishing Bobber - if (Main.rand.NextBool((int)(50f * rarityReduction)) && questsDone > 12) - { - item = new Item(); - item.SetDefaults(ItemID.FishingBobber); - rewardItems.Add(item); - } - - PlayerLoader.AnglerQuestReward(self, rarityReduction, rewardItems); - - foreach (Item rewardItem in rewardItems) - { - rewardItem.position = self.Center; - - Item getItem = self.GetItem(self.whoAmI, rewardItem, GetItemSettings.NPCEntityToPlayerInventorySettings); - - if (getItem.stack > 0) - { - int number = Item.NewItem(source, (int)self.position.X, (int)self.position.Y, self.width, self.height, getItem.type, getItem.stack, noBroadcast: false, 0, noGrabDelay: true); - - if (Main.netMode == NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); - } + int goldDrop = moneyDrop / 100; + Item gold = new Item(); + gold.SetDefaults(ItemID.GoldCoin); + gold.stack = goldDrop; + rewardItems.Add(gold); } + // Now the Silver Coins to drop. + int silverDrop = moneyDrop % 100; + Item silver = new Item(); + silver.SetDefaults(ItemID.SilverCoin); + silver.stack = silverDrop; + rewardItems.Add(silver); } #endregion diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 5c1034b6db..a287e37757 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -24,14 +24,12 @@ namespace CalamityMod.Items.Accessories player.accTackleBox = true; player.accLavaFishing = true; player.Calamity().fishingStation = true; - player.sonarPotion = true; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.LavaproofTackleBag). - AddIngredient(ItemID.SonarPotion, 5). AddIngredient(ItemID.MasterBait, 5). AddIngredient(5). AddTile(TileID.Anvils). diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index a6b1f231c2..2f7f3d7abe 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -3,9 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using CalamityMod.Balancing; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.ChatTags; using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; @@ -1753,6 +1750,108 @@ namespace CalamityMod.Items return false; } + if (line.Mod == "Terraria" && item.type == ModContent.ItemType() && (line.Name == "Tooltip1" || line.Name == "Tooltip2" || line.Name == "Tooltip4" || line.Name == "Tooltip5" || line.Name == "Tooltip7")) + { + Color rarityColor = Color.Black; + Vector2 basePosition = new Vector2(line.X, line.Y); + Vector2 backScale = line.BaseScale; + Player Owner = Main.LocalPlayer; + if (Owner is null) + return false; + + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 5 / MathHelper.Pi); + int draws = 20; + Color usedColor = Color.White; + if (line.Name == "Tooltip1" || line.Name == "Tooltip4" || line.Name == "Tooltip7") // Give the shifting color to the lines that need it + { + float rate = (Main.GlobalTimeWrappedHourly * 3); + List eColors = new List() + { + Owner.shirtColor, + Color.Lerp(Owner.shirtColor, Color.Black, 0.15f), + Color.Lerp(Owner.shirtColor, Color.White, 0.05f), + Color.Lerp(Owner.shirtColor, Color.White, 0.25f) + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + if (Owner.shirtColor == Color.White) + usedColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + } + + if (line.Name == "Tooltip5") // Shaky black outline + { + for (int i = 0; i < 4; i++) + { + Vector2 shake = Main.rand.NextVector2Circular(5, 5); + Vector2 backPosition = basePosition + shake; + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, rarityColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + } + if (line.Name == "Tooltip2" || line.Name == "Tooltip5") // Negative lines (inverted colors) + { + for (int i = 0; i < draws; i++) + { + Color clr = (line.Name == "Tooltip5") ? Color.Lerp(Color.White, Color.Black, sine) : Color.White; + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / draws).ToRotationVector2() * (1.5f + 0.2f * sine); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, clr with { A = 0 }, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Color clr2 = (line.Name == "Tooltip5") ? Color.Lerp(Color.Black, Color.White, sine) : Color.Black; + ChatManager.DrawColorCodedString(Main.spriteBatch, line.Font, line.Text, basePosition, clr2, line.Rotation, line.Origin, backScale); + return false; + + } + else if (line.Name == "Tooltip4") // Double outline + { + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / draws).ToRotationVector2() * (4.5f + 0.2f * sine); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, usedColor with { A = 0 }, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / draws).ToRotationVector2() * (2.5f + 0.2f * sine); + ChatManager.DrawColorCodedString(Main.spriteBatch, line.Font, line.Text, backPosition, Color.Black, line.Rotation, line.Origin, backScale); + } + + ChatManager.DrawColorCodedString(Main.spriteBatch, line.Font, line.Text, basePosition, Color.White, line.Rotation, line.Origin, backScale); + return false; + } + if (line.Name == "Tooltip7") // Dark horizon thing + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/Light").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = Color.Black; + Vector2 rotationPoint = texture.Size() * 0.5f; + for (int i = 0; i < 6; i++) + { + int length = line.Text.Length; + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, usedColor with { A = 0 }, (MathHelper.PiOver2), rotationPoint, new Vector2(0.9f - 0.085f * i, 1 + 2.7f * i * 1f) * 0.7f * Main.rand.NextFloat(0.95f, 1f), SpriteEffects.None); + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.9f - 0.05f * i, 1 + 4.5f * i * 1f) * 0.55f * Main.rand.NextFloat(0.95f, 1f), SpriteEffects.None); + } + + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / draws).ToRotationVector2() * (1.5f); + ChatManager.DrawColorCodedString(Main.spriteBatch, line.Font, line.Text, backPosition, usedColor with { A = 0 } * 0.6f, line.Rotation, line.Origin, backScale); + } + ChatManager.DrawColorCodedString(Main.spriteBatch, line.Font, line.Text, basePosition, Color.Black, line.Rotation, line.Origin, backScale); + return false; + } + if (line.Name == "Tooltip1") + { + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, usedColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + return false; + } + + // Draw the front text as usual as a backup just in case. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, Color.White, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + // Rainbow effect originally made for Orderbringer because it used to have a special rarity // But why did it have one in the first place?? // Might be used for Miracle stuff later or something idk diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 923004f6ac..8d7d50feb7 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -77,12 +77,12 @@ namespace CalamityMod.Items { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed, DamageExact(180), UseExact(45), ShootSpeedExact(22f)) }, { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, DamageExact(98)) }, { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(92), UseExact(10)) }, - { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, + { ItemID.ChristmasTreeSword, Do(UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, { ItemID.ClingerStaff, Do(DamageExact(63)) }, { ItemID.ClockworkAssaultRifle, Do(DamageExact(21)) }, { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, DamageExact(55), UseExact(9), ShootSpeedExact(12f)) }, { ItemID.CobaltRepeater, Do(UseExact(18)) }, - { ItemID.CobaltSword, Do(UseTurn, DamageExact(60), UseExact(9)) }, + { ItemID.CobaltSword, Do(DamageExact(60), UseExact(9)) }, { ItemID.Code2, Do(AutoReuse, DamageExact(43)) }, { ItemID.CoinGun, Do(UseExact(12)) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise @@ -95,21 +95,21 @@ namespace CalamityMod.Items { ItemID.CursedDart, Do(DamageExact(25)) }, { ItemID.Cutlass, Do(UseRatio(0.9f), DamageExact(90)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, - { ItemID.DaoofPow, Do(DamageExact(85)) }, + { ItemID.DaoofPow, Do(DamageExact(85)) }, // Displays as 170 damage { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(40)) }, { ItemID.DartRifle, Do(DamageExact(58)) }, { ItemID.DayBreak, Do(DamageExact(125), UseExact(20)) }, { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon { ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno - { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20), DamageExact(50)) }, + { ItemID.DeadlySphereStaff, Do(UseExact(20), DamageExact(50)) }, { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(70), ShootSpeedExact(15f)) }, { ItemID.DemonBow, Do(DamageExact(12), AutoReuse) }, { ItemID.DemonScythe, Do(AutoReuse, DamageExact(28)) }, { ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, DamageExact(24)) }, // Exotic Scimitar { ItemID.ElfMelter, Do(ShootSpeedDelta(+5f)) }, { ItemID.EmeraldStaff, Do(DamageExact(27)) }, - { ItemID.EmpressBlade, Do(AutoReuse, DamageExact(50), UseExact(20)) }, // Terraprisma + { ItemID.EmpressBlade, Do(DamageExact(50), UseExact(20)) }, // Terraprisma { ItemID.EnchantedBoomerang, Do(DamageExact(24)) }, { ItemID.EnchantedSword, Do(UseMeleeSpeed, DamageExact(30), ShootSpeedExact(15f)) }, { ItemID.EndlessMusketPouch, Do(DamageExact(8)) }, @@ -136,20 +136,20 @@ namespace CalamityMod.Items { ItemID.Handgun, Do(UseExact(20)) }, { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, { ItemID.HiveFive, Do(AutoReuse, DamageExact(27)) }, - { ItemID.HornetStaff, Do(AutoReuse, DamageExact(18), UseExact(30)) }, + { ItemID.HornetStaff, Do(DamageExact(18), UseExact(30)) }, { ItemID.IceBlade, Do(UseMeleeSpeed) }, { ItemID.IceBoomerang, Do(UseExact(25), ShootSpeedExact(9)) }, { ItemID.IceRod, Do(UseExact(6), ShootSpeedExact(20)) }, { ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(75), ShootSpeedExact(20f)) }, { ItemID.IchorArrow, Do(DamageExact(13)) }, { ItemID.IchorBullet, Do(DamageExact(11)) }, - { ItemID.ImpStaff, Do(AutoReuse, UseExact(30), DamageExact(25)) }, + { ItemID.ImpStaff, Do(UseExact(30), DamageExact(25)) }, { ItemID.InfernoFork, Do(DamageExact(83), ShootSpeedExact(11)) }, { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageExact(10)) }, { ItemID.Keybrand, Do(UseTurn) }, - { ItemID.Kraken, Do(AutoReuse, DamageExact(65)) }, { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // Uses ratios due to remix seed + { ItemID.Kraken, Do(AutoReuse, DamageExact(65)) }, { ItemID.LaserMachinegun, Do(DamageExact(49)) }, { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, @@ -190,7 +190,7 @@ namespace CalamityMod.Items { ItemID.PaladinsHammer, Do(DamageExact(95), ShootSpeedExact(28)) }, { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, DamageExact(120), ShootSpeedExact(5.4f)) }, { ItemID.PalladiumRepeater, Do(DamageExact(45)) }, - { ItemID.PalladiumSword, Do(UseTurn, DamageExact(150)) }, + { ItemID.PalladiumSword, Do(DamageExact(150)) }, { ItemID.PearlwoodBow, Do(AutoReuse, DamageExact(32)) }, { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, { ItemID.PewMaticHorn, Do(DamageExact(25), ShootSpeedExact(15)) }, @@ -203,11 +203,11 @@ namespace CalamityMod.Items { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, { ItemID.PurplePhaseblade, phaseblade }, { ItemID.PurplePhasesaber, phasesaber }, - { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(63)) }, + { ItemID.PygmyStaff, Do(UseExact(20), DamageExact(63)) }, { ItemID.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, { ItemID.RainbowRod, Do(DamageExact(40), ManaExact(13), KnockbackExact(8f)) }, { ItemID.Rally, Do(AutoReuse, DamageExact(18)) }, - { ItemID.RavenStaff, Do(AutoReuse, UseExact(20), DamageExact(36)) }, + { ItemID.RavenStaff, Do(UseExact(20), DamageExact(36)) }, { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, { ItemID.Razorpine, Do(DamageExact(40)) }, { ItemID.RedPhaseblade, phaseblade }, @@ -230,7 +230,7 @@ namespace CalamityMod.Items { ItemID.SilverShortsword, Do(AutoReuse, TrueMelee, DamageExact(14)) }, { ItemID.SkyFracture, Do(DamageExact(46)) }, { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, - { ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff + { ItemID.Smolstar, Do(DamageExact(9), UseExact(25)) }, // Blade Staff { ItemID.SniperRifle, Do(DamageExact(200), UseExact(40)) }, { ItemID.SolarEruption, Do(DamageExact(122)) }, { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain @@ -240,8 +240,8 @@ namespace CalamityMod.Items { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, { ItemID.StaffofEarth, Do(DamageExact(150)) }, { ItemID.StarCannon, Do(DamageExact(25), UseExact(15)) }, - { ItemID.StardustDragonStaff, Do(AutoReuse, DamageExact(20), UseExact(19)) }, - { ItemID.StormTigerStaff, Do(AutoReuse, DamageExact(49), UseExact(20)) }, // Desert Tiger Staff + { ItemID.StardustDragonStaff, Do(DamageExact(20), UseExact(19)) }, + { ItemID.StormTigerStaff, Do(DamageExact(49), UseExact(20)) }, // Desert Tiger Staff { ItemID.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, DamageExact(21)) }, // Stylish Scissors { ItemID.Stynger, Do(DamageExact(75)) }, { ItemID.SuperStarCannon, Do(DamageExact(55)) }, @@ -422,8 +422,7 @@ namespace CalamityMod.Items #endregion #region CATEGORY 5: Summoner Quality of Life - { ItemID.AbigailsFlower, autoReuse }, - { ItemID.BabyBirdStaff, Do(AutoReuse, UseExact(35)) }, // Finch Staff + { ItemID.BabyBirdStaff, Do(UseExact(35)) }, // Finch Staff { ItemID.BlandWhip, autoReuse }, // Leather Whip { ItemID.BoneWhip, autoReuse }, // Spinal Tap { ItemID.CoolWhip, autoReuse }, @@ -440,24 +439,24 @@ namespace CalamityMod.Items { ItemID.DD2LightningAuraT2Popper, Do(AutoReuse, UseExact(25)) }, // Lightning Aura Tier 2 { ItemID.DD2LightningAuraT3Popper, Do(AutoReuse, UseExact(20)) }, // Lightning Aura Tier 3 { ItemID.FireWhip, autoReuse }, // Firecracker - { ItemID.FlinxStaff, Do(AutoReuse, UseExact(35)) }, + { ItemID.FlinxStaff, Do(UseExact(35)) }, { ItemID.MaceWhip, autoReuse }, // Morning Star - { ItemID.OpticStaff, Do(AutoReuse, UseExact(25)) }, - { ItemID.PirateStaff, Do(AutoReuse, UseExact(25)) }, + { ItemID.OpticStaff, Do(UseExact(25)) }, + { ItemID.PirateStaff, Do(UseExact(25)) }, { ItemID.QueenSpiderStaff, Do(UseExact(25)) }, { ItemID.RainbowCrystalStaff, Do(UseExact(15)) }, { ItemID.RainbowWhip, autoReuse }, // Kaleidoscope - { ItemID.SanguineStaff, Do(AutoReuse, UseExact(25)) }, + { ItemID.SanguineStaff, Do(UseExact(25)) }, { ItemID.ScytheWhip, autoReuse }, // Dark Harvest - { ItemID.SlimeStaff, Do(AutoReuse, UseExact(30)) }, - { ItemID.SpiderStaff, Do(AutoReuse, UseExact(25)) }, + { ItemID.SlimeStaff, Do(UseExact(30)) }, + { ItemID.SpiderStaff, Do(UseExact(25)) }, { ItemID.StaffoftheFrostHydra, Do(UseExact(20)) }, - { ItemID.StardustCellStaff, Do(AutoReuse, UseExact(20)) }, + { ItemID.StardustCellStaff, Do(UseExact(20)) }, { ItemID.SwordWhip, autoReuse }, // Durendal - { ItemID.TempestStaff, Do(AutoReuse, UseExact(20)) }, + { ItemID.TempestStaff, Do(UseExact(20)) }, { ItemID.ThornWhip, autoReuse }, // Snapthorn - { ItemID.VampireFrogStaff, Do(AutoReuse, UseExact(30)) }, - { ItemID.XenoStaff, Do(AutoReuse, UseExact(20)) }, + { ItemID.VampireFrogStaff, Do(UseExact(30)) }, + { ItemID.XenoStaff, Do(UseExact(20)) }, #endregion #region CATEGORY 6: Other Quality of Life (AutoReuse / UseTurn) diff --git a/Items/Pets/FrostyBatBottle.cs b/Items/Pets/FrostyBatBottle.cs new file mode 100644 index 0000000000..b97b627ce1 --- /dev/null +++ b/Items/Pets/FrostyBatBottle.cs @@ -0,0 +1,46 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class FrostyBatBottle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Pets"; + public override void SetDefaults() + { + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 3); + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(Item.buffType, 3600, true); + } + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1.3f, + drawOffset: new(0f, 0f) + ); + return false; + } + } +} diff --git a/Items/Pets/FrostyBatBottle.png b/Items/Pets/FrostyBatBottle.png new file mode 100644 index 0000000000..52d2b8df6e Binary files /dev/null and b/Items/Pets/FrostyBatBottle.png differ diff --git a/Items/Pets/ToastyBatBottle.cs b/Items/Pets/ToastyBatBottle.cs new file mode 100644 index 0000000000..a9c70d9d67 --- /dev/null +++ b/Items/Pets/ToastyBatBottle.cs @@ -0,0 +1,46 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class ToastyBatBottle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Pets"; + public override void SetDefaults() + { + Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); + Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(gold: 3); + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(Item.buffType, 3600, true); + } + } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 1.3f, + drawOffset: new(0f, 0f) + ); + return false; + } + } +} diff --git a/Items/Pets/ToastyBatBottle.png b/Items/Pets/ToastyBatBottle.png new file mode 100644 index 0000000000..b762076bee Binary files /dev/null and b/Items/Pets/ToastyBatBottle.png differ diff --git a/Items/Placeables/Banners/BabyGhostBellBanner.png b/Items/Placeables/Banners/BabyGhostBellBanner.png index 6c1997b3b2..28922c83c1 100644 Binary files a/Items/Placeables/Banners/BabyGhostBellBanner.png and b/Items/Placeables/Banners/BabyGhostBellBanner.png differ diff --git a/Items/Placeables/Banners/CarrionSwallowerBanner.cs b/Items/Placeables/Banners/CarrionSwallowerBanner.cs new file mode 100644 index 0000000000..90902798cf --- /dev/null +++ b/Items/Placeables/Banners/CarrionSwallowerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class CarrionSwallowerBanner : BaseBanner + { + public override int BannerTileStyle => 131; + } +} diff --git a/Items/Placeables/Banners/CarrionSwallowerBanner.png b/Items/Placeables/Banners/CarrionSwallowerBanner.png new file mode 100644 index 0000000000..06ec2f37d3 Binary files /dev/null and b/Items/Placeables/Banners/CarrionSwallowerBanner.png differ diff --git a/Items/Placeables/Banners/ClamBanner.png b/Items/Placeables/Banners/ClamBanner.png index 74b65932d9..1aab94c02e 100644 Binary files a/Items/Placeables/Banners/ClamBanner.png and b/Items/Placeables/Banners/ClamBanner.png differ diff --git a/Items/Placeables/Banners/EutrophicRayBanner.png b/Items/Placeables/Banners/EutrophicRayBanner.png index 64815b0761..9ea5ff141d 100644 Binary files a/Items/Placeables/Banners/EutrophicRayBanner.png and b/Items/Placeables/Banners/EutrophicRayBanner.png differ diff --git a/Items/Placeables/Banners/GhostBellBanner.png b/Items/Placeables/Banners/GhostBellBanner.png index 74dcd77ed3..a9b012f504 100644 Binary files a/Items/Placeables/Banners/GhostBellBanner.png and b/Items/Placeables/Banners/GhostBellBanner.png differ diff --git a/Items/Placeables/Banners/GildedAxolotlBanner.png b/Items/Placeables/Banners/GildedAxolotlBanner.png new file mode 100644 index 0000000000..9fe9cd10c0 Binary files /dev/null and b/Items/Placeables/Banners/GildedAxolotlBanner.png differ diff --git a/Items/Placeables/Banners/GrubboltBanner.png b/Items/Placeables/Banners/GrubboltBanner.png new file mode 100644 index 0000000000..6c9733e5e4 Binary files /dev/null and b/Items/Placeables/Banners/GrubboltBanner.png differ diff --git a/Items/Placeables/Banners/HauntedChumBanner.cs b/Items/Placeables/Banners/HauntedChumBanner.cs new file mode 100644 index 0000000000..5613395082 --- /dev/null +++ b/Items/Placeables/Banners/HauntedChumBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class HauntedChumBanner : BaseBanner + { + public override int BannerTileStyle => 134; + } +} diff --git a/Items/Placeables/Banners/HauntedChumBanner.png b/Items/Placeables/Banners/HauntedChumBanner.png new file mode 100644 index 0000000000..711d5fa40f Binary files /dev/null and b/Items/Placeables/Banners/HauntedChumBanner.png differ diff --git a/Items/Placeables/Banners/JellyghoulBanner.cs b/Items/Placeables/Banners/JellyghoulBanner.cs new file mode 100644 index 0000000000..760cf5c86b --- /dev/null +++ b/Items/Placeables/Banners/JellyghoulBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class JellyghoulBanner : BaseBanner + { + public override int BannerTileStyle => 135; + } +} diff --git a/Items/Placeables/Banners/JellyghoulBanner.png b/Items/Placeables/Banners/JellyghoulBanner.png new file mode 100644 index 0000000000..01ded98a8a Binary files /dev/null and b/Items/Placeables/Banners/JellyghoulBanner.png differ diff --git a/Items/Placeables/Banners/KelpieSeadragonBanner.cs b/Items/Placeables/Banners/KelpieSeadragonBanner.cs new file mode 100644 index 0000000000..a3048b0a20 --- /dev/null +++ b/Items/Placeables/Banners/KelpieSeadragonBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class KelpieSeadragonBanner : BaseBanner + { + public override int BannerTileStyle => 136; + } +} diff --git a/Items/Placeables/Banners/KelpieSeadragonBanner.png b/Items/Placeables/Banners/KelpieSeadragonBanner.png new file mode 100644 index 0000000000..6a08e30355 Binary files /dev/null and b/Items/Placeables/Banners/KelpieSeadragonBanner.png differ diff --git a/Items/Placeables/Banners/LazarusLampfishBanner.cs b/Items/Placeables/Banners/LazarusLampfishBanner.cs new file mode 100644 index 0000000000..64ea4ba955 --- /dev/null +++ b/Items/Placeables/Banners/LazarusLampfishBanner.cs @@ -0,0 +1,10 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + [LegacyName("BlindedAnglerBanner")] + public class LazarusLampfishBanner : BaseBanner + { + public override int BannerTileStyle => 104; + } +} diff --git a/Items/Placeables/Banners/LazarusLampfishBanner.png b/Items/Placeables/Banners/LazarusLampfishBanner.png new file mode 100644 index 0000000000..e6d468d0e6 Binary files /dev/null and b/Items/Placeables/Banners/LazarusLampfishBanner.png differ diff --git a/Items/Placeables/Banners/LeerslugBanner.cs b/Items/Placeables/Banners/LeerslugBanner.cs new file mode 100644 index 0000000000..16370c2bec --- /dev/null +++ b/Items/Placeables/Banners/LeerslugBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class LeerslugBanner : BaseBanner + { + public override int BannerTileStyle => 137; + } +} diff --git a/Items/Placeables/Banners/LeerslugBanner.png b/Items/Placeables/Banners/LeerslugBanner.png new file mode 100644 index 0000000000..a4eaf2a916 Binary files /dev/null and b/Items/Placeables/Banners/LeerslugBanner.png differ diff --git a/Items/Placeables/Banners/LostShoalBanner.cs b/Items/Placeables/Banners/LostShoalBanner.cs new file mode 100644 index 0000000000..b63af3b21d --- /dev/null +++ b/Items/Placeables/Banners/LostShoalBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class LostShoalBanner : BaseBanner + { + public override int BannerTileStyle => 138; + } +} diff --git a/Items/Placeables/Banners/LostShoalBanner.png b/Items/Placeables/Banners/LostShoalBanner.png new file mode 100644 index 0000000000..7c9a0febca Binary files /dev/null and b/Items/Placeables/Banners/LostShoalBanner.png differ diff --git a/Items/Placeables/Banners/MirageNewtBanner.png b/Items/Placeables/Banners/MirageNewtBanner.png new file mode 100644 index 0000000000..1424910e5c Binary files /dev/null and b/Items/Placeables/Banners/MirageNewtBanner.png differ diff --git a/Items/Placeables/Banners/PanaseaBanner.png b/Items/Placeables/Banners/PanaseaBanner.png new file mode 100644 index 0000000000..8c85af80ca Binary files /dev/null and b/Items/Placeables/Banners/PanaseaBanner.png differ diff --git a/Items/Placeables/Banners/PearlpodBanner.cs b/Items/Placeables/Banners/PearlpodBanner.cs new file mode 100644 index 0000000000..bf3ba1b781 --- /dev/null +++ b/Items/Placeables/Banners/PearlpodBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class PearlpodBanner : BaseBanner + { + public override int BannerTileStyle => 141; + } +} diff --git a/Items/Placeables/Banners/PearlpodBanner.png b/Items/Placeables/Banners/PearlpodBanner.png new file mode 100644 index 0000000000..e341098eb2 Binary files /dev/null and b/Items/Placeables/Banners/PearlpodBanner.png differ diff --git a/Items/Placeables/Banners/PodobooKoiBanner.cs b/Items/Placeables/Banners/PodobooKoiBanner.cs new file mode 100644 index 0000000000..14ac5680a0 --- /dev/null +++ b/Items/Placeables/Banners/PodobooKoiBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class PodobooKoiBanner : BaseBanner + { + public override int BannerTileStyle => 143; + } +} diff --git a/Items/Placeables/Banners/PodobooKoiBanner.png b/Items/Placeables/Banners/PodobooKoiBanner.png new file mode 100644 index 0000000000..c2b67aa9cc Binary files /dev/null and b/Items/Placeables/Banners/PodobooKoiBanner.png differ diff --git a/Items/Placeables/Banners/PolyperilBanner.cs b/Items/Placeables/Banners/PolyperilBanner.cs new file mode 100644 index 0000000000..6bc04212fd --- /dev/null +++ b/Items/Placeables/Banners/PolyperilBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class PolyperilBanner : BaseBanner + { + public override int BannerTileStyle => 144; + } +} diff --git a/Items/Placeables/Banners/PolyperilBanner.png b/Items/Placeables/Banners/PolyperilBanner.png new file mode 100644 index 0000000000..bd04faf38e Binary files /dev/null and b/Items/Placeables/Banners/PolyperilBanner.png differ diff --git a/Items/Placeables/Banners/PrismBackBanner.png b/Items/Placeables/Banners/PrismBackBanner.png index 1f467b4d74..cc05ba7917 100644 Binary files a/Items/Placeables/Banners/PrismBackBanner.png and b/Items/Placeables/Banners/PrismBackBanner.png differ diff --git a/Items/Placeables/Banners/PrismaticGuppyBanner.cs b/Items/Placeables/Banners/PrismaticGuppyBanner.cs new file mode 100644 index 0000000000..583fa7aa71 --- /dev/null +++ b/Items/Placeables/Banners/PrismaticGuppyBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class PrismaticGuppyBanner : BaseBanner + { + public override int BannerTileStyle => 145; + } +} diff --git a/Items/Placeables/Banners/PrismaticGuppyBanner.png b/Items/Placeables/Banners/PrismaticGuppyBanner.png new file mode 100644 index 0000000000..7c2acc6c4b Binary files /dev/null and b/Items/Placeables/Banners/PrismaticGuppyBanner.png differ diff --git a/Items/Placeables/Banners/ProbesnoutBanner.png b/Items/Placeables/Banners/ProbesnoutBanner.png index 40c40de9f3..331b966302 100644 Binary files a/Items/Placeables/Banners/ProbesnoutBanner.png and b/Items/Placeables/Banners/ProbesnoutBanner.png differ diff --git a/Items/Placeables/Banners/SandProwlerBanner.cs b/Items/Placeables/Banners/SandProwlerBanner.cs new file mode 100644 index 0000000000..9fef623265 --- /dev/null +++ b/Items/Placeables/Banners/SandProwlerBanner.cs @@ -0,0 +1,10 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + [LegacyName("SeaSerpentBanner")] + public class SandProwlerBanner : BaseBanner + { + public override int BannerTileStyle => 106; + } +} diff --git a/Items/Placeables/Banners/SandProwlerBanner.png b/Items/Placeables/Banners/SandProwlerBanner.png new file mode 100644 index 0000000000..c440619fe1 Binary files /dev/null and b/Items/Placeables/Banners/SandProwlerBanner.png differ diff --git a/Items/Placeables/Banners/ScavengerBanner.cs b/Items/Placeables/Banners/ScavengerBanner.cs new file mode 100644 index 0000000000..3c38808a7d --- /dev/null +++ b/Items/Placeables/Banners/ScavengerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class ScavengerBanner : BaseBanner + { + public override int BannerTileStyle => 146; + } +} diff --git a/Items/Placeables/Banners/ScavengerBanner.png b/Items/Placeables/Banners/ScavengerBanner.png new file mode 100644 index 0000000000..4d894c8707 Binary files /dev/null and b/Items/Placeables/Banners/ScavengerBanner.png differ diff --git a/Items/Placeables/Banners/SeaFloatyBanner.png b/Items/Placeables/Banners/SeaFloatyBanner.png index 1578c3e4dc..3f38042d8a 100644 Binary files a/Items/Placeables/Banners/SeaFloatyBanner.png and b/Items/Placeables/Banners/SeaFloatyBanner.png differ diff --git a/Items/Placeables/Banners/SeaMinnowBanner.png b/Items/Placeables/Banners/SeaMinnowBanner.png index aa6eebf84f..2419202e4b 100644 Binary files a/Items/Placeables/Banners/SeaMinnowBanner.png and b/Items/Placeables/Banners/SeaMinnowBanner.png differ diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs deleted file mode 100644 index ef12cc3ebc..0000000000 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class SeaSerpentBanner : BaseBanner - { - public override int BannerTileStyle => 106; - } -} diff --git a/Items/Placeables/Banners/SeaSerpentBanner.png b/Items/Placeables/Banners/SeaSerpentBanner.png deleted file mode 100644 index e384093d74..0000000000 Binary files a/Items/Placeables/Banners/SeaSerpentBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SearslugBanner.cs b/Items/Placeables/Banners/SearslugBanner.cs new file mode 100644 index 0000000000..0d16292aac --- /dev/null +++ b/Items/Placeables/Banners/SearslugBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SearslugBanner : BaseBanner + { + public override int BannerTileStyle => 147; + } +} diff --git a/Items/Placeables/Banners/SearslugBanner.png b/Items/Placeables/Banners/SearslugBanner.png new file mode 100644 index 0000000000..1851a2640f Binary files /dev/null and b/Items/Placeables/Banners/SearslugBanner.png differ diff --git a/Items/Placeables/Banners/SharkoonBanner.png b/Items/Placeables/Banners/SharkoonBanner.png index 6dcf32bad3..e42d222bd7 100644 Binary files a/Items/Placeables/Banners/SharkoonBanner.png and b/Items/Placeables/Banners/SharkoonBanner.png differ diff --git a/Items/Placeables/Banners/ShoreskipperBanner.png b/Items/Placeables/Banners/ShoreskipperBanner.png new file mode 100644 index 0000000000..c08cb19213 Binary files /dev/null and b/Items/Placeables/Banners/ShoreskipperBanner.png differ diff --git a/Items/Placeables/Banners/SlugbunBanner.cs b/Items/Placeables/Banners/SlugbunBanner.cs new file mode 100644 index 0000000000..ebdb7624cd --- /dev/null +++ b/Items/Placeables/Banners/SlugbunBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SlugbunBanner : BaseBanner + { + public override int BannerTileStyle => 149; + } +} diff --git a/Items/Placeables/Banners/SlugbunBanner.png b/Items/Placeables/Banners/SlugbunBanner.png new file mode 100644 index 0000000000..c7f6060a39 Binary files /dev/null and b/Items/Placeables/Banners/SlugbunBanner.png differ diff --git a/Items/Placeables/Banners/SteampodBanner.cs b/Items/Placeables/Banners/SteampodBanner.cs new file mode 100644 index 0000000000..f62212ebc6 --- /dev/null +++ b/Items/Placeables/Banners/SteampodBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SteampodBanner : BaseBanner + { + public override int BannerTileStyle => 150; + } +} diff --git a/Items/Placeables/Banners/SteampodBanner.png b/Items/Placeables/Banners/SteampodBanner.png new file mode 100644 index 0000000000..a503c69f5b Binary files /dev/null and b/Items/Placeables/Banners/SteampodBanner.png differ diff --git a/Items/Placeables/Banners/StormlionBanner.png b/Items/Placeables/Banners/StormlionBanner.png index 23afbabbfa..e15ff2bc86 100644 Binary files a/Items/Placeables/Banners/StormlionBanner.png and b/Items/Placeables/Banners/StormlionBanner.png differ diff --git a/Items/Placeables/Banners/StormlionScoutBanner.png b/Items/Placeables/Banners/StormlionScoutBanner.png new file mode 100644 index 0000000000..8eda3688b6 Binary files /dev/null and b/Items/Placeables/Banners/StormlionScoutBanner.png differ diff --git a/Items/Placeables/Banners/StormlionSentryBanner.cs b/Items/Placeables/Banners/StormlionSentryBanner.cs new file mode 100644 index 0000000000..62ba388dca --- /dev/null +++ b/Items/Placeables/Banners/StormlionSentryBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class StormlionSentryBanner : BaseBanner + { + public override int BannerTileStyle => 142; + } +} diff --git a/Items/Placeables/Banners/StormlionSentryBanner.png b/Items/Placeables/Banners/StormlionSentryBanner.png new file mode 100644 index 0000000000..67bab5c7e6 Binary files /dev/null and b/Items/Placeables/Banners/StormlionSentryBanner.png differ diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 84daab017c..24078e605a 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -80,9 +80,6 @@ namespace CalamityMod.Items.TreasureBags // Vanity itemLoot.Add(ModContent.ItemType(), 7); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - - // Fishing - itemLoot.Add(ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index 42d1b0abc6..477e33e006 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -83,9 +83,6 @@ namespace CalamityMod.Items.TreasureBags // Vanity itemLoot.Add(ModContent.ItemType(), 7); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - - // Fishing - itemLoot.Add(ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs deleted file mode 100644 index e371b23910..0000000000 --- a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Terraria; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags.MiscGrabBags -{ - public class BleachedAnglingKit : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.TreasureBags"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 10; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - } - - public override void SetDefaults() - { - Item.width = 24; - Item.height = 24; - Item.maxStack = Item.CommonMaxStack; - Item.consumable = true; - Item.rare = ItemRarityID.Pink; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } - - public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) - { - // Different drop rates on Normal and Expert, so define normal first, then expert - var normalOnly = itemLoot.DefineNormalOnlyDropSet(); - normalOnly.Add(ItemID.FishermansGuide, 18); - normalOnly.Add(ItemID.WeatherRadio, 18); - normalOnly.Add(ItemID.Sextant, 18); - normalOnly.Add(ItemID.FishingPotion, 3, 2, 3); - normalOnly.Add(ItemID.SonarPotion, 3, 2, 3); - normalOnly.Add(ItemID.CratePotion, 3, 2, 3); - normalOnly.Add(ItemID.GoldCoin, 1, 3, 4); - - var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); - expertPlus.Add(ItemID.FishermansGuide, 14); - expertPlus.Add(ItemID.WeatherRadio, 14); - expertPlus.Add(ItemID.Sextant, 14); - expertPlus.Add(ItemID.FishingPotion, 2, 2, 3); - expertPlus.Add(ItemID.SonarPotion, 2, 2, 3); - expertPlus.Add(ItemID.CratePotion, 2, 2, 3); - expertPlus.Add(ItemID.GoldCoin, 1, 4, 5); - } - } -} diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.png b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.png deleted file mode 100644 index 6b26715325..0000000000 Binary files a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.png and /dev/null differ diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs deleted file mode 100644 index c2b5e5076f..0000000000 --- a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Terraria; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.TreasureBags.MiscGrabBags -{ - public class SandyAnglingKit : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.TreasureBags"; - - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 10; - } - - public override void SetDefaults() - { - Item.width = 24; - Item.height = 24; - Item.maxStack = Item.CommonMaxStack; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } - - public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) - { - // Different drop rates on Normal and Expert, so define normal first, then expert - var normalOnly = itemLoot.DefineNormalOnlyDropSet(); - normalOnly.Add(ItemID.FishermansGuide, 20); - normalOnly.Add(ItemID.WeatherRadio, 20); - normalOnly.Add(ItemID.Sextant, 20); - normalOnly.Add(ItemID.FishingPotion, 3, 2, 3); - normalOnly.Add(ItemID.SonarPotion, 3, 2, 3); - normalOnly.Add(ItemID.CratePotion, 3, 2, 3); - normalOnly.Add(ItemID.GoldCoin, 1, 1, 2); - - var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); - expertPlus.Add(ItemID.FishermansGuide, 16); - expertPlus.Add(ItemID.WeatherRadio, 16); - expertPlus.Add(ItemID.Sextant, 16); - expertPlus.Add(ItemID.FishingPotion, 2, 2, 3); - expertPlus.Add(ItemID.SonarPotion, 2, 2, 3); - expertPlus.Add(ItemID.CratePotion, 2, 2, 3); - expertPlus.Add(ItemID.GoldCoin, 1, 2, 3); - } - } -} diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.png b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.png deleted file mode 100644 index f8948c63bd..0000000000 Binary files a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index b3ebf087f6..551e98efe1 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 26; Item.height = 26; - Item.damage = 980; + Item.damage = 1350; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 24; Item.useAnimation = 24; diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 695c21e84c..5e024bb094 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -141,8 +141,8 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; - // If the parry holdout has existed for very few frames and hasn't parried something, just delete it. - if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames && parrier.ai[1] <= 0f) + // If the parry holdout has existed for very few frames, just delete it. + if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames) { parrier.active = false; parrier.netUpdate = true; diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index b910c11097..c9556bffb6 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(8). AddTile(). Register(); diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 177303a7cd..928c535962 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -144,8 +144,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). + AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). AddTile(TileType()). diff --git a/Items/Weapons/Melee/Lightspeed.cs b/Items/Weapons/Melee/Lightspeed.cs new file mode 100644 index 0000000000..4ce6f0bd22 --- /dev/null +++ b/Items/Weapons/Melee/Lightspeed.cs @@ -0,0 +1,68 @@ +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Melee; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + [LegacyName("ElementalShortsword", "ElementalShiv")] + public class Lightspeed : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static int MaxEnergy = 100; + + public override void SetDefaults() + { + Item.width = 74; + Item.height = 94; + Item.useStyle = ItemUseStyleID.Shoot; + Item.damage = 196; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 20; + Item.shootSpeed = 10f; + Item.knockBack = 2f; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + Item.shoot = ModContent.ProjectileType(); + + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.autoReuse = true; + Item.channel = true; + base.SetDefaults(); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override void HoldItem(Player player) + { + if (player.Calamity().cooldowns.TryGetValue(ElementalMastery.ID, out var cooldown)) + { + cooldown.timeLeft = player.Calamity().elementalMastery; + } + else + { + player.AddCooldown(ElementalMastery.ID, 0); + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.PiercingStarlight). + AddIngredient(). + AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(ItemID.FragmentSolar, 5). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/StarburstShiv.png b/Items/Weapons/Melee/Lightspeed.png similarity index 100% rename from Items/Weapons/Melee/StarburstShiv.png rename to Items/Weapons/Melee/Lightspeed.png diff --git a/Items/Weapons/Melee/StarburstShivGlow.png b/Items/Weapons/Melee/LightspeedGlow.png similarity index 100% rename from Items/Weapons/Melee/StarburstShivGlow.png rename to Items/Weapons/Melee/LightspeedGlow.png diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 557ec7e81e..7a855ec3e7 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,20 +1,14 @@ -using System; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; -using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; -using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; -using Terraria.Audio; -using CalamityMod.Items.Weapons.Summon; using Terraria.ModLoader; -using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.Items.Weapons.Melee { diff --git a/Items/Weapons/Melee/StarburstShiv.cs b/Items/Weapons/Melee/StarburstShiv.cs deleted file mode 100644 index 88897649f7..0000000000 --- a/Items/Weapons/Melee/StarburstShiv.cs +++ /dev/null @@ -1,50 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Shortswords; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - [LegacyName("ElementalShortsword", "ElementalShiv")] - public class StarburstShiv : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - public override void SetDefaults() - { - Item.width = 74; - Item.height = 94; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 138; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 13; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 2.4f; - Item.knockBack = 8.5f; - Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - } - - public override bool MeleePrefix() => true; - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/StarburstShivGlow").Value); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.PiercingStarlight). - AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). - AddIngredient(ItemID.FragmentSolar, 5). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 489bc4baea..20b20c1cb3 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static int AftershotCooldownFrames = 9; public static int Charge1Frames = 156; public static int Charge2Frames = 308; + public static Color mainColor = new Color(116, 225, 0); public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 58; Item.height = 28; - Item.damage = 172; + Item.damage = 125; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.noMelee = true; @@ -65,8 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(3). - AddIngredient(ItemID.MartianConduitPlating, 15). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index d060ef0483..5445754757 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/PlasmaBlast"); + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/StarfleetStar"); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Ranged/NullificationPistol.cs b/Items/Weapons/Ranged/NullificationPistol.cs index 4cbb64ff49..dbc8265159 100644 --- a/Items/Weapons/Ranged/NullificationPistol.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -43,17 +43,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => true; public override float UseSpeedMultiplier(Player player) { - if (player.altFunctionUse == 2) - return 1.3f; + return 1.3f - (float)(1 - Math.Pow(Utils.GetLerpValue(0, shotType ? 0.175f : 0.25f, mult, true), 2.5f)); if (Main.zenithWorld) return 3 * (shotType ? 0.7f : 1); if (!shotType) - return 1.5f - mult; + return 1.5f - ((mult > 0.25f) ? mult : 0); - return 1f - mult; + return 1f - ((mult > 0.175f) ? mult : 0); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -75,7 +74,8 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int i = 0; i < 3; i++) Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 3, 0, player.whoAmI, 0, 0, i); - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0, 0); + if (mult < 0.175f) + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, 0, player.whoAmI, 0, 0); if (mult < 0.35f) mult += 0.013f; } @@ -83,14 +83,27 @@ namespace CalamityMod.Items.Weapons.Ranged { Projectile aBeam = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.7f), 0, player.whoAmI, 0, 5); aBeam.penetrate = 1; - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0, 5); + if (mult < 0.25f) + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 0.75f), 0, player.whoAmI, 0, 5); if (mult < 0.5f) mult += 0.013f; } if (player.altFunctionUse != 2) { SoundStyle fire = new("CalamityMod/Sounds/Item/NullShot"); - SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (!shotType ? 0.3f : 0) }, position); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (!shotType ? 0.3f : 0) - (shotType ? ((mult > 0.25f) ? mult : 0) : ((mult > 0.175f) ? mult : 0)) }, position); + + if (mult >= (shotType ? 0.175f : 0.25f)) + { + for (int i = 0; i < 18; i++) + { + Dust dust = Dust.NewDustPerfect(position + velocity * 8, ModContent.DustType(), (velocity).RotatedByRandom(0.5) * Main.rand.NextFloat(0.4f, 1f)); + dust.noGravity = !Main.rand.NextBool(4); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f); + dust.color = Main.rand.NextBool() ? Color.White : (Main.rand.NextBool() ? Color.Orchid : Color.Turquoise); + dust.fadeIn = 7.5f; + } + } } return false; } diff --git a/Items/Weapons/Ranged/OntologicalDespoiler.cs b/Items/Weapons/Ranged/OntologicalDespoiler.cs index 5e8eb56f16..6b55cd9968 100644 --- a/Items/Weapons/Ranged/OntologicalDespoiler.cs +++ b/Items/Weapons/Ranged/OntologicalDespoiler.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; @@ -55,15 +54,12 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 25; public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override void HoldItem(Player player) { if (Main.myPlayer == player.whoAmI) player.Calamity().rightClickListener = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Only one out at a time @@ -72,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse) + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().despoilerNerf) { Projectile holdout2 = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, Item.shoot, player.ActiveItem().damage, 0f, player.whoAmI, 0, 0, 10 + (shotType ? 5 : 0)); holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); @@ -87,38 +83,12 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } - public override void ModifyTooltips(List list) - { - Player Owner = Main.LocalPlayer; - if (Owner is null) - return; - float rate = (Main.GlobalTimeWrappedHourly * 3); - List eColors = new List() - { - Owner.shirtColor, - Color.Lerp(Owner.shirtColor, Color.Black, 0.3f), - Color.Lerp(Owner.shirtColor, Color.White, 0.2f), - Color.Lerp(Owner.shirtColor, Color.White, 0.4f) - }; - int colorIndex = (int)(rate / 2 % eColors.Count); - Color currentColor = eColors[colorIndex]; - Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - Color eTooltipColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); - if (Owner.shirtColor == Color.White) - eTooltipColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip7"); - if (line != null) - line.OverrideColor = Color.Lerp(eTooltipColor, Color.White, 0.2f); - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(2). - AddIngredient(). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 48e4980900..7faadcb28c 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -1,12 +1,13 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using System.Linq; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Ranged { @@ -17,46 +18,53 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 76; Item.height = 36; - Item.damage = 115; + Item.damage = 2888; Item.DamageType = DamageClass.Ranged; - Item.useTime = 55; - Item.useAnimation = 55; + Item.useTime = 70; + Item.useAnimation = 70; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 15f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item92; + Item.channel = true; + Item.noUseGraphic = true; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.useAmmo = AmmoID.FallenStar; } - - public override Vector2? HoldoutOffset() + // Holdout projectile is spawned when holding the item, so using the item does nothing + public override bool CanUseItem(Player player) => false; + public override void ModifyTooltips(List list) { - return new Vector2(-8, -11); - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - for (int index = 0; index < 5; ++index) + Player Owner = Main.LocalPlayer; + if (Owner is null) + return; + float rate = (Main.GlobalTimeWrappedHourly * 3); + List eColors = new List() { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - } - return false; - } + new Color(146, 255, 211), + new Color(222, 225, 146), + new Color(255, 233, 146) + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color eTooltipColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip7"); + if (line != null) + line.OverrideColor = Color.Lerp(eTooltipColor, Color.White, 0.2f); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.SuperStarCannon). - AddIngredient(6). AddIngredient(4). - AddIngredient(12). - AddTile(TileID.MythrilAnvil). + AddIngredient(ItemID.FallenStar, 15). + AddIngredient(3). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Ranged/StarfleetGlow.png b/Items/Weapons/Ranged/StarfleetGlow.png new file mode 100644 index 0000000000..27e53bab19 Binary files /dev/null and b/Items/Weapons/Ranged/StarfleetGlow.png differ diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index 0c8b0f5641..96d212d876 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -1,15 +1,15 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Ranged { @@ -25,54 +25,50 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 122; Item.height = 50; - Item.damage = 150; + Item.damage = 4900; Item.DamageType = DamageClass.Ranged; - Item.useAnimation = Item.useTime = 15; + Item.useAnimation = Item.useTime = 70; Item.knockBack = 15f; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.Item92; - Item.autoReuse = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.channel = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; Item.useAmmo = AmmoID.FallenStar; - Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } - - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + // Holdout projectile is spawned when holding the item, so using the item does nothing + public override bool CanUseItem(Player player) => false; + public override void ModifyTooltips(List list) { - for (int i = 0; i < 5; i++) + Player Owner = Main.LocalPlayer; + if (Owner is null) + return; + float rate = (Main.GlobalTimeWrappedHourly * 3); + List eColors = new List() { - int starType = Utils.SelectRandom(Main.rand, - [ - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ProjectileID.StarCannonStar, - ProjectileID.Starfury - ]); - int star = Projectile.NewProjectile(source, position + Main.rand.NextVector2Circular(21f, 21f), velocity * Main.rand.NextFloat(0.8f, 1.2f), starType, damage, knockback, player.whoAmI); - if (star.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].DamageType = DamageClass.Ranged; - Main.projectile[star].netUpdate = true; - } - } - return false; - } + new Color(164, 47, 160), + new Color(227, 97, 72), + new Color(193, 255, 146) + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color eTooltipColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip8"); + if (line != null) + line.OverrideColor = Color.Lerp(eTooltipColor, Color.White, 0.2f); + } public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddIngredient(15). + AddIngredient(5). + AddIngredient(25). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Starmada.png b/Items/Weapons/Ranged/Starmada.png index 3cef0ffadf..b9c45f34cb 100644 Binary files a/Items/Weapons/Ranged/Starmada.png and b/Items/Weapons/Ranged/Starmada.png differ diff --git a/Items/Weapons/Ranged/StarmadaGlow.png b/Items/Weapons/Ranged/StarmadaGlow.png new file mode 100644 index 0000000000..f7d1a7365e Binary files /dev/null and b/Items/Weapons/Ranged/StarmadaGlow.png differ diff --git a/Items/Weapons/Rogue/Pumpkaboom.cs b/Items/Weapons/Rogue/Pumpkaboom.cs new file mode 100644 index 0000000000..5e17b4e136 --- /dev/null +++ b/Items/Weapons/Rogue/Pumpkaboom.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class Pumpkaboom : RogueWeapon + { + public override void SetDefaults() + { + Item.width = 26; + Item.height = 34; + Item.damage = 20; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.useTime = Item.useAnimation = 70; + Item.useStyle = ItemUseStyleID.Swing; + Item.knockBack = 2f; + Item.UseSound = null; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.DamageType = RogueDamageClass.Instance; + } + + public override float StealthDamageMultiplier => 1f; + + public override bool CanUseItem(Player player) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Item.shoot && projectile.localAI[1] < 5 && projectile.owner == player.whoAmI) + { + return false; + } + } + return true; + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; + + return false; + } + return true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Grenade, 15). + AddIngredient(ItemID.Pumpkin, 10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Rogue/Pumpkaboom.png b/Items/Weapons/Rogue/Pumpkaboom.png new file mode 100644 index 0000000000..4d612c1005 Binary files /dev/null and b/Items/Weapons/Rogue/Pumpkaboom.png differ diff --git a/Items/Weapons/Summon/FlarebatStaff.cs b/Items/Weapons/Summon/FlarebatStaff.cs deleted file mode 100644 index 91f6eb0365..0000000000 --- a/Items/Weapons/Summon/FlarebatStaff.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Summon -{ - public class FlarebatStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - - public override void SetDefaults() - { - Item.damage = 20; - Item.DamageType = DamageClass.Summon; - Item.buffType = ModContent.BuffType(); - Item.shoot = ModContent.ProjectileType(); - Item.knockBack = 1f; - - Item.useAnimation = Item.useTime = 15; - (Item.width, Item.height) = (50, 50); - Item.mana = 10; - Item.noMelee = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item20; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddBuff(Item.buffType, 2); - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - minion.originalDamage = Item.damage; - return false; - } - } -} diff --git a/Items/Weapons/Summon/FlarebatStaff.png b/Items/Weapons/Summon/FlarebatStaff.png deleted file mode 100644 index 22e7b112ab..0000000000 Binary files a/Items/Weapons/Summon/FlarebatStaff.png and /dev/null differ diff --git a/Items/Weapons/Summon/FrostbatStaff.cs b/Items/Weapons/Summon/FrostbatStaff.cs deleted file mode 100644 index a8148b1e5b..0000000000 --- a/Items/Weapons/Summon/FrostbatStaff.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Summon -{ - public class FrostbatStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - - public override void SetDefaults() - { - Item.damage = 22; - Item.DamageType = DamageClass.Summon; - Item.buffType = ModContent.BuffType(); - Item.shoot = ModContent.ProjectileType(); - Item.knockBack = 1f; - - Item.useAnimation = Item.useTime = 15; - (Item.width, Item.height) = (50, 50); - Item.mana = 10; - Item.noMelee = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item28; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddBuff(Item.buffType, 2); - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - minion.originalDamage = Item.damage; - return false; - } - } -} diff --git a/Items/Weapons/Summon/FrostbatStaff.png b/Items/Weapons/Summon/FrostbatStaff.png deleted file mode 100644 index 1c99a19da7..0000000000 Binary files a/Items/Weapons/Summon/FrostbatStaff.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 1805648e7c..75e346d7da 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1290,11 +1290,6 @@ FieryDraconidBuff: { Description: The fiery draconid will protect you } -FlarebatBuff: { - DisplayName: Flarebat - Description: The construct of fire will protect you -} - FleshBallBuff: { DisplayName: Flesh Ball Description: Why is it following you? @@ -1305,11 +1300,6 @@ FlowersOfMortalityBuff: { Description: Celestial blossoms surround you } -FrostbatBuff: { - DisplayName: Frostbat - Description: The construct of ice will protect you -} - FrostBlossomBuff: { DisplayName: Frost Blossom Description: A cold, prickly flower is floating uncomfortably close to you @@ -1670,5 +1660,15 @@ ForbiddenStealthSummonTagBuff: { SeaKingsAssurance: { DisplayName: Sea Kings Assurance - Description: Mods.CalamityMod.Buffs.SeaKingsAssurance.Description + Description: If you're seeing this, something assuredly went horribly wrong +} + +FrostyBatBuff: { + DisplayName: Frosty Bat Friend + Description: A frosty bat flits about +} + +ToastyBatBuff: { + DisplayName: Toasty Bat Friend + Description: A fiery bat flutters at your shoulder } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index c1bdc7ab78..60b3c0f0b4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1844,7 +1844,7 @@ SupremeBaitTackleBoxFishingStation: { ''' Increases fishing power by 50 Fishing line will never break and decreases chance of bait consumption - Allows fishing in lava and detects hooked fish + Allows fishing in lava ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index c5a3e29830..3ba3ea1a9b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -60,7 +60,7 @@ FlashRound: { DisplayName: Flash Round Tooltip: ''' - A ricocheting bullet that confuses enemies when it flashes and deals more damage with each bounce + A ricocheting bullet that deals more damage with each bounce The damage bonus is 1.13x or +2 flat damage per bounce, depending on which is stronger ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson index 06dae2e293..f19502c196 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Pets.hjson @@ -75,6 +75,16 @@ FoxDrive: { ''' } +FrostyBatBottle: { + DisplayName: Frosty Bat Bottle + Tooltip: + ''' + Summons an icy bat to light your way that flies towards your cursor when you dash + {$Common.AbyssLightLevel1} + [c/6ECAC3:'All the world's bats are prime to squeak!'] + ''' +} + GeyserShell: { DisplayName: Geyser Shell Tooltip: Summons a little flak hermit @@ -189,6 +199,16 @@ ThiefsDime: { ''' } +ToastyBatBottle: { + DisplayName: Toasty Bat Bottle + Tooltip: + ''' + Summons a fiery bat to light your way that leaves a trail of glowing embers + {$Common.AbyssLightLevel1} + [c/CF6454:'Guaranteed to NOT knock you off your hellbridge'] + ''' +} + TrashmanTrashcan: { DisplayName: Trash Can Tooltip: Summons the trash man diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 746f0693ae..d4d6a338b9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -26,6 +26,7 @@ BohldohrBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BoxJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CalamityEyeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +CarrionSwallowerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ChaoticPufferBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CladCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ClamBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -57,12 +58,18 @@ GiantSquidBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GnasherBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GulperEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HadarianBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +HauntedChumBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HeatSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IceClasperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ImpiousImmolatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" InfernalCongealmentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IrradiatedSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +JellyghoulBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +KelpieSeadragonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LaserfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +LazarusLampfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +LeerslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +LostShoalBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LuminousCorvinaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisShrimpBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -74,6 +81,7 @@ NuclearToadBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OarfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OrthoceraBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OverloadedSoldierBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PearlpodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PerennialSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PestilentSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PhantomSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -81,7 +89,10 @@ PiggyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlaguebringerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueChargerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueshellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PodobooKoiBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PolyperilBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PrismBackBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +PrismaticGuppyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ProbesnoutBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ProfanedEnergyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RadiatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -91,12 +102,14 @@ RepairUnitBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RimehoundBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RotdogBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RubyCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SandProwlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SapphireCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ScavengerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScornEaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScryllarBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaFloatyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SeaSerpentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SearslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SharkoonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShockstormShuttleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShroombleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -104,9 +117,12 @@ SightseerColliderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerSpitterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SkyfinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SlabCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SlugbunBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SoulSlurperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SteampodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StellarCulexBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StormlionBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +StormlionSentryBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulflounderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulphurousSkaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SunskaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 52367ac720..fe583cd6b0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -190,7 +190,7 @@ CinnamonRoll: { } PurpleHaze: { - DisplayName: purpleHaze + DisplayName: Purple Haze Tooltip: ''' {0}% increased damage, but lowers defense by {1}% diff --git a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson index fc0cf2f1ac..61238dff19 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson @@ -130,15 +130,6 @@ AbyssalTreasure: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } -BleachedAnglingKit: { - DisplayName: Bleached Angling Kit - Tooltip: - ''' - Has a chance to contain various fishing gear - {$CommonItemTooltip.RightClickToOpen} - ''' -} - FleshyGeode: { DisplayName: Fleshy Geode Tooltip: "{$CommonItemTooltip.RightClickToOpen}" @@ -149,15 +140,6 @@ NecromanticGeode: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } -SandyAnglingKit: { - DisplayName: Sandy Angling Kit - Tooltip: - ''' - Has a chance to contain various fishing gear - {$CommonItemTooltip.RightClickToOpen} - ''' -} - StarterBag: { DisplayName: Starter Bag Tooltip: "{$CommonItemTooltip.RightClickToOpen}" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 42a0b9ac7c..869e969340 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -798,6 +798,17 @@ LifehuntScythe: { Tooltip: Heals you on hit and shoots an energy scythe } +Lightspeed: { + DisplayName: Lightspeed + Tooltip: + ''' + [c/c7f5ff:Unleash a flurry of stabs which build Elemental Mastery on hit] + [c/c2fff2:Elemental Mastery is lost over time but briefly stops depleting after reaching its maximum] + [c/ffdfba:Press with maximum Elemental Mastery to dash toward your cursor] + [c/ffc7c7:Hitting an enemy during the dash refunds some Elemental Mastery] + ''' +} + LionHeart: { DisplayName: Lion Heart Tooltip: @@ -1176,11 +1187,6 @@ SpineOfThanatos: { ''' } -StarburstShiv: { - DisplayName: Starburst Shiv - Tooltip: Shoots a rainbow shiv that spawns additional shivs on hit -} - StarnightLance: { DisplayName: Starnight Lance Tooltip: Shoots a frigid starnight beam diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 6561921f4c..3543f0a636 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -95,7 +95,7 @@ ArcNovaDiffuser: { ''' Charges and fires a rapid burst of nova bolts The first charging stage increases the fire rate of the burst - The second charging stage replaces the rapid burst with a devastating nova blast + The second charging stage replaces the rapid burst with a devastating nova blast that always crits ''' } @@ -832,7 +832,7 @@ OntologicalDespoiler: { Null condensate shots fire rapidly and home in on enemies At 50% charge or higher, rate of fire significantly increases Fully charged unstable condensate lobs a homing disruption sphere - Fully charged null condensate emits a hitscan null-annihilation beam + Fully charged null condensate emits a hitscan null-annihilation beam that always crits Each mode charges slower when used repeatedly and resets to full speed when swapped 'Rob them of continuity and the laws of physics they hold so dear.' ''' @@ -1194,15 +1194,32 @@ Spyker: { Starfleet: { DisplayName: Starfleet - Tooltip: Fires a spread of plasma blasts + Tooltip: + ''' + fires a spread of starshots + fires a concussive short range starburst + Holding down disables the recoil damper + Starshots can be accelerated by firing when the starburst goes off + Perfect timing reduces spread and increases damage + Imperfect timing still increases damage, but heavily increases spread + Uses fallen stars, 50% chance to save ammo + 'Etoile, et toi' + ''' } Starmada: { DisplayName: Starmada Tooltip: ''' - Fires a barrage of stars and plasma blasts - {$CommonItemTooltip.PercentChanceToSaveAmmo} + fires a spread of starshots + fires a concussive short range starburst + Holding down disables the recoil damper + Starshots can be accelerated by firing when the starburst goes off + Perfect timing reduces spread, increases damage, and adds a stacking weapon power buff + Imperfect timing still increases damage, but heavily increases spread and reduces weapon power + The weapon power buff strengthens both starshots and the concussive starburst + Uses fallen stars, 50% chance to save ammo + 'Et toi, et moi' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index e997671cfc..cfd3dff3a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1396,3 +1396,12 @@ WulfrumKnife: { to magnetize all stuck knives back to you, restoring stealth ''' } + +Pumpkaboom: { + DisplayName: Pumpkaboom + Tooltip: + ''' + Throws a pumpkin which sticks to enemies and explodes after a delay + Stealth strikes throw larger pumpkins which pull enemies in before releasing a larger explosion + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 6fa1a9ea05..580a0190a4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -927,24 +927,6 @@ YharonsKindleStaff: { ''' } -FlarebatStaff: { - DisplayName: Flarebat Staff - Tooltip: - ''' - Summons a bat construct of pure fire to fight for you - Swoops towards foes with great haste - ''' -} - -FrostbatStaff: { - DisplayName: Frostbat Staff - Tooltip: - ''' - Summons a bat construct of pure ice to fight for you - Swoops towards foes with slow and precise maneuvers - ''' -} - AmphibiansGuitar: { DisplayName: Amphibian's Guitar Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 96f1f31200..3dbef36de0 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -171,9 +171,7 @@ Frogfish.DisplayName: Frogfish Horse.DisplayName: Earth Elemental IceClasper.DisplayName: Ice Clasper ImpiousImmolator.DisplayName: Impious Immolator -KingSlimeJewelEmerald.DisplayName: Emerald Jewel KingSlimeJewelRuby.DisplayName: Ruby Jewel -KingSlimeJewelSapphire.DisplayName: Sapphire Jewel LavaSlimeNoLavaDrop.DisplayName: Lava Slime MantisShrimp.DisplayName: Mantis Shrimp OverloadedSoldier.DisplayName: Overloaded Soldier diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index ed22fc9981..0b40593ead 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -127,8 +127,6 @@ ProfanedSpear.DisplayName: Profaned Spear ProvidenceCrystal.DisplayName: Holy Crystal ProvidenceCrystalShard.DisplayName: Holy Crystal Shard ProvidenceHolyRay.DisplayName: Holy Ray -QueenBeenade.DisplayName: Queen Beenade -QueenBeenadeBee.DisplayName: Queen Beenade Bee RavagerBlast.DisplayName: Ravaging Laser RavagerBlaster.DisplayName: Ravager Blaster RavagerFlame.DisplayName: Blue Flame diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 95c7ba3d4f..d6fdfb3ee0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -159,6 +159,9 @@ LamentationsOfTheChained.DisplayName: Lamentations of the Chained LifeScythe.DisplayName: Lifehunt Scythe LightBeam.DisplayName: Light Beam LightningThing.DisplayName: Lightning +LightspeedDashHitbox.DisplayName: Lightspeed Rupture +LightspeedHoldout.DisplayName: Lightspeed +LightspeedM1Hitbox.DisplayName: Lightspeed Stab LucreciaProj.DisplayName: Lucrecia LucreciaDNATrailCreator.DisplayName: Lucrecia DNA LucreciaDoubleHelix.DisplayName: Lucrecia Helix Comet diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson index b4bc7c0ea2..c9d79d855f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Pets.hjson @@ -10,6 +10,7 @@ DaawnlightSpiritOriginMinion.DisplayName: Daawnlight DannyDevitoPet.DisplayName: Danny Devito EidolonSnail.DisplayName: Escargidolon Snail FlakPet.DisplayName: Flak Hermit +FrostyBatPet.DisplayName: Frosty Bat Friend FoxPet.DisplayName: Fox GoldiePet.DisplayName: Goldie KendraPet.DisplayName: Kendra @@ -28,4 +29,5 @@ RotomPet.DisplayName: Rotom SCalPet.DisplayName: Supreme Calamitas Sparks.DisplayName: Sparks ThirdSage.DisplayName: Third Sage +ToastyBatPet.DisplayName: Toasty Bat Friend YharonSonPet.DisplayName: Son of Yharon diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 7e21c5eb3a..0efa140c93 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -152,7 +152,6 @@ PlagueTaintedDrone.DisplayName: Plague Tainted Drone PlanarRipperBolt.DisplayName: Planar Bolt PlanarRipperExplosion.DisplayName: Planar Explosion PlanetaryAnnihilationProj.DisplayName: Planetary Ball -PlasmaBlast.DisplayName: Plasma Blast PlasmaExplosion.DisplayName: Plasma Explosion PolarStar.DisplayName: Star Shot PrecisionBolt.DisplayName: Precision Bolt @@ -212,6 +211,9 @@ SproutingArrowSplit.DisplayName: Sprouting Arrow SputterComet.DisplayName: Sputter Comet SputterCometBig.DisplayName: Sputter Comet SpykerProj.DisplayName: Spyker +StarfleetStar.DisplayName: Starfleet Star +StarmadaHitProj.DisplayName: Starmada +StarmadaStar.DisplayName: Starmada Star StarmageddonBinaryStarCenter.DisplayName: Starmageddon Binary Star Center StarmageddonStar.DisplayName: Starmageddon Star StarmageddonStar2.DisplayName: Starmageddon Star diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 136d2e0487..51c57ca16b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -204,6 +204,10 @@ PrismRocket.DisplayName: Prism Rocket PrismShurikenBlade.DisplayName: Refraction Blade ProfanedPartisanProj.DisplayName: Profaned Partisan ProfanedPartisanSpear.DisplayName: Profaned Spear +PumpkaboomSmall.DisplayName: Small Pumpkaboom +PumpkaboomBoomSmall.DisplayName: Pump-kaboom! +PumpkaboomBig.DisplayName: Big Pumpkaboom +PumpkaboomBoomBig.DisplayName: Pump-KABOOM!! RadiantExplosion.DisplayName: Radiant Explosion RadiantStar2.DisplayName: Radiant Star RadiantStarKnife.DisplayName: Radiant Star diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 8571335f31..6948439f61 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -329,7 +329,5 @@ WulfrumDroid.DisplayName: Wulfrum Droid WulfrumEnergyBurst.DisplayName: Wulfrum Bolt WulfrumFusionBolt.DisplayName: Fusion Bolt YharonMinionFireball.DisplayName: Dragon Fireball -FlarebatMinion.DisplayName: Flarebat -FrostbatMinion.DisplayName: Frostbat AmphibiansGuitarMinion.DisplayName: Amphibian's Guitars AmphibiansGuitarProjectile.DisplayName: Note diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 4c662427b5..e28f82f335 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -107,6 +107,7 @@ Cooldowns: { DivingPlatesBroken: Abyssal Diving Suit Broken Plates DSOCritCooldown: Extra Critical Strike Chance ParryCooldown: Parry Ability Cooldown + ElementalMastery: Elemental Mastery FleshTotem: Contact Damage Halving Cooldown FuryFuel: Crystal Powder GaelsRage: Gael's Greatsword Rage Cooldown diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 741dcb63e1..b117ab35fe 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -328,8 +328,6 @@ namespace CalamityMod // Enemies EnemyRedirect(NPCType(), "Crown Jewels"); - EnemyRedirect(NPCType(), "Crown Jewels"); - EnemyRedirect(NPCType(), "Crown Jewels"); EnemyRedirect(NPCType(), "Tooth Ball (Old Duke)"); EnemyRedirect(NPCType(), "Enchantment"); EnemyRedirect(NPCType(), "%3F%3F%3F"); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index f7277274af..544197bc7d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -692,9 +692,6 @@ namespace CalamityMod.NPCs.AquaticScourge normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); - - // Fishing - normalOnly.Add(ModContent.ItemType()); } npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 499a2bcb04..21386f7c6e 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -74,9 +74,6 @@ namespace CalamityMod.NPCs.CalClone NPC.width = 120; NPC.height = 120; - if (CalamityWorld.death || BossRushEvent.BossRushActive) - NPC.scale *= 0.8f; - NPC.defense = 25; NPC.value = Item.buyPrice(gold: 15); NPC.LifeMaxNERB(39000, 46875, 520000); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d5256ecdf6..c1e95adb16 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -998,7 +998,6 @@ namespace CalamityMod.NPCs #endregion - bool hasModHotOil = false; //Apply DoT Debuffs for (var index = 0; index < npc.buffType.Count(); index++) { @@ -1007,8 +1006,6 @@ namespace CalamityMod.NPCs if (debuffData == null || debuffData == DebuffData.Oiled) //Oiled is done after continue; debuffData.NPCLifeRegenMethod(npc, type, ref index,ref damage); - if (debuffData.HeatDebuffScaling > 0) - hasModHotOil = true; } //Oiled comes after so that we can detect if they have a heat debuff in the above loop bool hasVanillaOil = npc.onFrostBurn || npc.onFrostBurn2 || npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; @@ -1411,11 +1408,6 @@ namespace CalamityMod.NPCs #region Revengeance and Death Mode Stat Changes private void RevDeathStatChanges(NPC npc, Mod mod) { - if (CalamityNPCSets.DeathModeSplittingWorm[npc.type] && CalamityWorld.death) - { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); - } - if (npc.type == NPCID.Mothron) { npc.scale *= 1.25f; @@ -3076,19 +3068,6 @@ namespace CalamityMod.NPCs } #endregion - #region Boss Head Slot - public override void BossHeadSlot(NPC npc, ref int index) - { - if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) - { - float lifeRatio = npc.life / (float)npc.lifeMax; - float mapIconVanishValue = 0.3f; - if (lifeRatio < mapIconVanishValue || lifeRatio > 0.9f) - index = -1; - } - } - #endregion - #region Pre AI public override bool PreAI(NPC npc) { @@ -3726,21 +3705,6 @@ namespace CalamityMod.NPCs case NPCID.BloodEelBody: case NPCID.BloodEelTail: return RevengeanceAndDeathAI.BuffedWormAI(npc, Mod); - - // Death Mode splitting worms. - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - if (CalamityWorld.death) - return RevengeanceAndDeathAI.BuffedWormAI(npc, Mod); - else - return true; } break; @@ -6603,9 +6567,6 @@ namespace CalamityMod.NPCs if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && Main.zenithWorld)) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); - if (npc.type == NPCID.KingSlime && CalamityWorld.death) - return NPC.AnyNPCs(NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; - if (npc.type == NPCID.QueenBee && Main.zenithWorld) { if (npc.life / (float)npc.lifeMax < 0.5f) @@ -6908,13 +6869,13 @@ namespace CalamityMod.NPCs // Draw the glowmasks. int frameCounter = (int)npc.frameCounter / 4; - Rectangle frame = TextureAssets.Extra[106].Value.Frame(1, 8); + Rectangle frame = TextureAssets.Extra[ExtrasID.GolemLights4].Value.Frame(1, 8); frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y; Rectangle glowFrame = frame; - spriteBatch.Draw(TextureAssets.Extra[106].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights4].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); frame = npc.frame; Rectangle glowFrame2 = frame; - spriteBatch.Draw(TextureAssets.Extra[107].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights5].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); // Draw the sparkle telegraphs for the laser spread attack if applicable. if (npc.ai[0] == 3f && npc.ai[1] <= 60f) @@ -7571,26 +7532,6 @@ namespace CalamityMod.NPCs } } - if (CalamityWorld.death) - { - switch (npc.type) - { - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - return true; - - default: - break; - } - } - return null; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 7720436ee9..9ffa8cc567 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -303,9 +303,9 @@ namespace CalamityMod.NPCs #region Ice // Ice Bat - // Frostbat Staff @ 6.67% + // Frosty Bat Bottle @ 7.14% case NPCID.IceBat: - npcLoot.Add(ModContent.ItemType(), 15); + npcLoot.Add(ModContent.ItemType(), 14); break; // Undead Viking, Armored Viking @@ -635,10 +635,10 @@ namespace CalamityMod.NPCs #region Hell // Hellbat - // Flarebat Staff @ 4% + // Toasty Bat Bottle @ 3.33% // Magma Stone @ 1.33% (0.67% in Vanilla) case NPCID.Hellbat: - npcLoot.Add(ModContent.ItemType(), 25); + npcLoot.Add(ModContent.ItemType(), 30); npcLoot.ChangeDropRate(ItemID.MagmaStone, 1, 75); break; @@ -1945,14 +1945,6 @@ namespace CalamityMod.NPCs if (AcidRainEvent.AcidRainEventIsOngoing) AcidRainEvent.OnEnemyKill(npc); - // Stop Death Mode splitting worms from dropping excessive loot - if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, Mod)) - DropHelper.BlockEverything(); - - // Correctly increment bestiary entries for splitting worms - if (npc.AnyInteractions()) - SplittingWormBestiaryUpdate(npc); - // Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is. bool lastTwinStanding = false; if (npc.type == NPCID.Retinazer) @@ -2205,121 +2197,5 @@ namespace CalamityMod.NPCs } } #endregion - - #region Splitting Worm Loot - internal static void SplittingWormBroadcastInteractionWrapper(NPC npc, int player) - { - if (!CalamityWorld.death) - return; - - switch (npc.type) - { - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - SplittingWormBroadcastInteraction(npc, player, NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); - return; - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: - SplittingWormBroadcastInteraction(npc, player, NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); - return; - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - SplittingWormBroadcastInteraction(npc, player, NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); - return; - } - } - - internal static void SplittingWormBroadcastInteraction(NPC npc, int player, int head, int body, int tail) - { - foreach (NPC n in Main.ActiveNPCs) - { - if (n.whoAmI != npc.whoAmI && (n.type == head || n.type == body || n.type == tail)) - { - n.ApplyInteraction(player); - } - } - } - - internal static void SplittingWormBestiaryUpdate(NPC npc) - { - if (!CalamityWorld.death) - return; - - switch (npc.type) - { - case NPCID.DiggerBody: - case NPCID.DiggerTail: - NPC diggerHead = new(); - diggerHead.SetDefaults(NPCID.DiggerHead); - Main.BestiaryTracker.Kills.RegisterKill(diggerHead); - return; - case NPCID.SeekerBody: - case NPCID.SeekerTail: - NPC seekerHead = new(); - seekerHead.SetDefaults(NPCID.SeekerHead); - Main.BestiaryTracker.Kills.RegisterKill(seekerHead); - return; - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - NPC duneSplicerHead = new(); - duneSplicerHead.SetDefaults(NPCID.DuneSplicerHead); - Main.BestiaryTracker.Kills.RegisterKill(duneSplicerHead); - return; - } - } - - internal static bool SplittingWormLootBlockWrapper(NPC npc, Mod mod) - { - if (!CalamityWorld.death) - return true; - - switch (npc.type) - { - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - return SplittingWormLoot(npc, mod, 0); - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: - return SplittingWormLoot(npc, mod, 1); - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - return SplittingWormLoot(npc, mod, 2); - default: - return true; - } - } - - internal static bool SplittingWormLoot(NPC npc, Mod mod, int wormType) - { - switch (wormType) - { - case 0: return CheckSegments(NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); - case 1: return CheckSegments(NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); - case 2: return CheckSegments(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); - default: - break; - } - - bool CheckSegments(int head, int body, int tail) - { - foreach (NPC n in Main.ActiveNPCs) - { - if (n.whoAmI != npc.whoAmI && (n.type == head || n.type == body || n.type == tail)) - { - return false; - } - } - return true; - } - - return true; - } - #endregion } } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 6cd8ea55a7..36f19d090d 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -190,6 +190,7 @@ namespace CalamityMod.NPCs "Gol D. Roger", // <@!256228859110752257> (xtra3678) "Yarrim", // <@!290061123137306624> (borb9834) "Hector Barbossa", // <@!615704209303797790> (thatrockisfullamagic) + "Blunderbeard", // <@!1039460813490102293> (parmiigianoreggiano) }; private static readonly string[] PrincessNames = { @@ -350,7 +351,6 @@ namespace CalamityMod.NPCs "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) "Octo", // <@!796112889353994281> (octolinggrimm) - "Chease", // <@!1039460813490102293> (parmiigianoreggiano) }; private static readonly string[] TownCatSiameseNames = null; private static readonly string[] TownCatBlackNames = diff --git a/NPCs/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs index ac34f3d460..88b16dbaba 100644 --- a/NPCs/CalamityPierceResistance.cs +++ b/NPCs/CalamityPierceResistance.cs @@ -58,10 +58,13 @@ namespace CalamityMod.NPCs exemptProjectiles.Add(ProjectileID.ClingerStaff); exemptProjectiles.Add(ProjectileID.FinalFractal); exemptProjectiles.Add(ProjectileID.FlyingKnife); + exemptProjectiles.Add(ProjectileID.HallowJoustingLance); + exemptProjectiles.Add(ProjectileID.JoustingLance); exemptProjectiles.Add(ProjectileID.LastPrismLaser); exemptProjectiles.Add(ProjectileType()); // Included here as it does not have a projectile exemptProjectiles.Add(ProjectileID.MonkStaffT3); exemptProjectiles.Add(ProjectileID.PiercingStarlight); + exemptProjectiles.Add(ProjectileID.ShadowJoustingLance); exemptProjectiles.Add(ProjectileID.Terragrim); // Specific vanilla projectile single hitbox exemptions @@ -156,7 +159,8 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= 1f - damageReduction; - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) + bool aiStyleExempt = projectile.aiStyle == ProjAIStyleID.Flail || projectile.aiStyle == ProjAIStyleID.MechanicalPiranha || projectile.aiStyle == ProjAIStyleID.Yoyo; + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass() && !aiStyleExempt) projectile.Calamity().timesPierced++; } } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 531fdd9487..3874ca553a 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -250,7 +250,7 @@ namespace CalamityMod.NPCs.Crabulon // Avoid cheap bullshit NPC.damage = 0; - float walkingVelocity = death ? (5f + 2f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f; + float walkingVelocity = death ? (5f + 1f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f; if (phase2) walkingVelocity += 0.5f; if (phase3) @@ -328,7 +328,7 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; - float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f); + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 60f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) { NPC.noGravity = false; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 8ade55c3dc..3c43aa9738 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void BossHeadSlot(ref int index) { - if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !CalamityWorld.death) + if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) index = -1; } @@ -167,7 +167,7 @@ namespace CalamityMod.NPCs.DesertScourge bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Check for Nuisances - bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !death; + bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())); if (hide) { NPC.Calamity().newAI[0] = 0f; @@ -997,9 +997,6 @@ namespace CalamityMod.NPCs.DesertScourge // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - - // Fishing - normalOnly.Add(ModContent.ItemType()); } // Trophy (always directly from boss, never in bag) diff --git a/NPCs/NormalNPCs/BucketZombie.cs b/NPCs/NormalNPCs/BucketZombie.cs index 0da926be3c..2321ab6522 100644 --- a/NPCs/NormalNPCs/BucketZombie.cs +++ b/NPCs/NormalNPCs/BucketZombie.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.45f; NPC.npcSlots = 1.15f; // Equal to the strongest variants NPC.value = Item.buyPrice(silver: 1); - Banner = NPCID.Zombie; + Banner = Item.NPCtoBanner(NPCID.Zombie); BannerItem = ItemID.ZombieBanner; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs deleted file mode 100644 index 0379b92424..0000000000 --- a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs +++ /dev/null @@ -1,312 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CalPlayer; -using CalamityMod.Events; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -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; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class KingSlimeJewelEmerald : ModNPC - { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald"; - - private const int ChargePhaseGateValue = 120; - private const int ChargeGateValue = 60; - private const int ChargeGateValue_Death = 40; - private const float LightTelegraphDuration = 30f; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); - } - - public override void SetDefaults() - { - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 24; // 72 (Death exlusive) - NPC.width = 32; - NPC.height = 32; - NPC.defense = 15; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 240; - NPC.knockBackResist = 0.7f; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit5; - NPC.DeathSound = SoundID.NPCDeath15; - NPC.Calamity().VulnerableToSickness = false; - } - - public override void AI() - { - // Despawn - if (!CalamityPlayer.areThereAnyDamnBosses) - { - NPC.life = 0; - OnKill(); - NPC.active = false; - NPC.netUpdate = true; - return; - } - - Lighting.AddLight(NPC.Center, 0f, 0.8f, 0f); - - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - CalamityUtils.CalamityTargeting(NPC, default); - } - - if (NPC.ai[3] == 1f) - { - NPC.knockBackResist = 0f; - - if (NPC.ai[0] == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.velocity *= CalamityWorld.death ? 0.94f : 0.96f; - - NPC.ai[1] += 1f; - - float anglularSpeed = NPC.ai[1] / (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue); - anglularSpeed = 0.1f + anglularSpeed * 0.4f; - NPC.rotation += anglularSpeed * NPC.direction; - - if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue)) - { - for (int dusty = 0; dusty < 10; dusty++) - { - Vector2 dustVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * Main.rand.NextFloat(-4f, -1f); - int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); - Main.dust[emerald].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[emerald].scale = 0.5f; - Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SoundID.Item38, NPC.Center); - - NPC.ai[0] = 1f; - NPC.ai[1] = 0f; - NPC.netUpdate = true; - } - } - else if (NPC.ai[0] == 1f) - { - // Set damage - NPC.damage = NPC.defDamage; - - float chargeSpeed = CalamityWorld.death ? 24f : 16f; - NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * chargeSpeed; - NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - - NPC.ai[0] = 2f; - NPC.ai[1] = 0f; - NPC.ForceNetUpdate(); - } - else if (NPC.ai[0] == 2f) - { - // Set damage - NPC.damage = NPC.defDamage; - - NPC.rotation += MathHelper.ToRadians(Math.Sign(NPC.velocity.X) * 15); - - CustomSprite spriteParticle = new CustomSprite(NPC.Center - NPC.velocity, NPC.velocity * 0.8f, 10, "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald", 1.2f, Color.DarkGreen.MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); - spriteParticle.Rotation = NPC.rotation; - - GeneralParticleHandler.SpawnParticle(spriteParticle); - - NPC.ai[1] += 1f; - if (NPC.ai[1] >= (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - for (int dusty = 0; dusty < 10; dusty++) - { - Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f); - int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); - Main.dust[emerald].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[emerald].scale = 0.5f; - Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - - NPC.velocity = Vector2.Zero; - } - } - } - else - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.knockBackResist = 0.7f; - - NPC.rotation = NPC.velocity.X / 15f; - - float velocity = 5f; - float acceleration = 0.2f; - - if (NPC.position.Y > Main.player[NPC.target].position.Y - 200f) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y -= acceleration; - - if (NPC.velocity.Y > velocity) - NPC.velocity.Y = velocity; - } - else if (NPC.position.Y < Main.player[NPC.target].position.Y - 300f) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y += acceleration; - - if (NPC.velocity.Y < -velocity) - NPC.velocity.Y = -velocity; - } - - if (NPC.Center.X > Main.player[NPC.target].Center.X + 200f) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X -= acceleration; - - if (NPC.velocity.X > 8f) - NPC.velocity.X = 8f; - } - if (NPC.Center.X < Main.player[NPC.target].Center.X - 200f) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X += acceleration; - - if (NPC.velocity.X < -8f) - NPC.velocity.X = -8f; - } - - NPC.ai[2] += 1f; - if (NPC.ai[2] >= ChargePhaseGateValue) - { - NPC.ai[2] = 0f; - NPC.ai[3] = 1f; - NPC.netUpdate = true; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Color col = Color.DarkOliveGreen; - Color flashCol = Color.Lime; - - float alph = 0f; - - float colorTelegraphGateValue = (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue) - LightTelegraphDuration; - - if (NPC.ai[0] > colorTelegraphGateValue) - alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); - - Asset tex = ModContent.Request(Texture); - Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); - - Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); - Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); - - return false; - } - - public override void OnKill() - { - for (int i = 0; i < 6; i++) - { - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.DarkSeaGreen)); - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Lime)); - } - - float start = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 3; i++) - GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeEmeraldShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); - - SoundEngine.PlaySound(KingSlimeJewelRuby.ShatterSound, NPC.Center); - } - - public override Color? GetAlpha(Color drawColor) => Color.White; - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * balance); - } - - public override bool CheckActive() => false; - - public override void HitEffect(NPC.HitInfo hit) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); - Main.dust[dust].noGravity = true; - - if (NPC.life <= 0) - { - NPC.position = NPC.Center; - NPC.width = NPC.height = 45; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int i = 0; i < 2; i++) - { - int emeraldDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[emeraldDust].noGravity = true; - Main.dust[emeraldDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[emeraldDust].scale = 0.5f; - Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - for (int j = 0; j < 10; j++) - { - int emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); - Main.dust[emeraldDust2].noGravity = true; - Main.dust[emeraldDust2].velocity *= 5f; - emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[emeraldDust2].noGravity = true; - Main.dust[emeraldDust2].velocity *= 2f; - } - } - } - } -} diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 78e7fd1c13..1352b941dd 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -1,8 +1,6 @@ -using System.Collections.Generic; -using System.Runtime.InteropServices; +using System; using CalamityMod.CalPlayer; using CalamityMod.Events; -using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -11,10 +9,8 @@ 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 System.Net.Mime.MediaTypeNames; namespace CalamityMod.NPCs.NormalNPCs { @@ -22,13 +18,20 @@ namespace CalamityMod.NPCs.NormalNPCs { public static readonly SoundStyle ShatterSound = new SoundStyle("CalamityMod/Sounds/NPCKilled/CrownJewelShatter"); public static readonly SoundStyle ShootSound = new SoundStyle("CalamityMod/Sounds/Custom/RedJewelFire"); + public static readonly SoundStyle ModeShiftSound = new SoundStyle("CalamityMod/Sounds/Custom/RedJewelModeShift"); + private const int BoltShootGateValue = 60; - private const int BoltShootGateValue_Death = 75; - private const float LightTelegraphDuration = 45f; + private const int BoltShootGateValue_Death = 60; + private const float RubyLightTelegraphDuration = 45f; public static int JewelBoltDamage = 10; // 40 + private const int EmeraldChargePhaseGateValue = 120; + private const int EmeraldChargeGateValue = 60; + private const int EmeraldChargeGateValue_Death = 40; + private const float EmeraldLightTelegraphDuration = 30f; + public override void SetStaticDefaults() { NPCID.Sets.NeedsExpertScaling[Type] = true; @@ -40,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; + NPC.damage = 24; // 72. Contact damage only occurs in the "Emerald" phase, which is Death exclusive. NPC.width = 32; NPC.height = 32; NPC.defense = 10; @@ -58,7 +61,6 @@ namespace CalamityMod.NPCs.NormalNPCs { bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - // Despawn if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; @@ -68,106 +70,383 @@ namespace CalamityMod.NPCs.NormalNPCs return; } - Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); - - // Float around the player - NPC.rotation = NPC.velocity.X / 15f; - - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC kingSlime = null; + foreach (NPC n in Main.npc) { - CalamityUtils.CalamityTargeting(NPC, default); - } - - float velocity = 5f; - float acceleration = 0.1f; - - if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y -= acceleration; - - if (NPC.velocity.Y > velocity) - NPC.velocity.Y = velocity; - } - else if (NPC.position.Y < Main.player[NPC.target].position.Y - 450f) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y += acceleration; - - if (NPC.velocity.Y < -velocity) - NPC.velocity.Y = -velocity; - } - - if (NPC.Center.X > Main.player[NPC.target].Center.X + 100f) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X -= acceleration; - - if (NPC.velocity.X > 8f) - NPC.velocity.X = 8f; - } - if (NPC.Center.X < Main.player[NPC.target].Center.X - 100f) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X += acceleration; - - if (NPC.velocity.X < -8f) - NPC.velocity.X = -8f; - } - - // Fire projectiles - NPC.ai[0] += 1f; - if (NPC.ai[0] >= (death ? BoltShootGateValue_Death : BoltShootGateValue)) - { - NPC.ai[0] = 0f; - - Vector2 npcPos = NPC.Center; - float xDist = Main.player[NPC.target].Center.X - npcPos.X; - float yDist = Main.player[NPC.target].Center.Y - npcPos.Y; - Vector2 projVector = new Vector2(xDist, yDist); - float projLength = projVector.Length(); - - float speed = death ? 12f : 10f; - int type = ModContent.ProjectileType(); - - projLength = speed / projLength; - projVector.X *= projLength; - projVector.Y *= projLength; - - for (int i = 0; i < 6; i++) + if (n.active && n.type == NPCID.KingSlime) { - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + kingSlime = n; + break; } + } - SoundEngine.PlaySound(ShootSound, NPC.Center); + // Invincibility logic + if (death && kingSlime != null && kingSlime.active) + { + NPC.dontTakeDamage = true; + } + else + { + NPC.dontTakeDamage = false; + } - if (Main.netMode != NetmodeID.MultiplayerClient) + float kingSlimeLifeRatio = (kingSlime != null && kingSlime.active) ? (float)kingSlime.life / kingSlime.lifeMax : 1f; + + bool isInitialEmeraldPhase = death && (kingSlimeLifeRatio < 0.55f && kingSlimeLifeRatio >= 0.35f); + bool isAlternatingPhase = death && kingSlimeLifeRatio < 0.35f; + + // [0]: 0f = ruby AI, 1f = emerald AI + // [1]: Ruby attack counter + // [2]: Emerald attack counter + // [3]: Phase (0f = standard, 1f = initial Emerald, 2f = alternating) + if (isInitialEmeraldPhase) + { + if (NPC.localAI[3] != 1f) // Transition to initial Emerald phase { - if (death) + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 1f; // Become emerald + NPC.localAI[1] = 0; + NPC.localAI[2] = 0; + NPC.localAI[3] = 1f; // Set overall phase flag to initial Emerald + + SoundEngine.PlaySound(ModeShiftSound with { Volume = 0.5f }); + NPC.netUpdate = true; + + for (int i = 0; i < 6; i++) { - int numProj = 4; - float rotation = MathHelper.ToRadians(18); - for (int i = 0; i < numProj; i++) + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } + } + } + + else if (isAlternatingPhase) + { + if (NPC.localAI[3] != 2f) // Transition to alternating phase + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; // Become ruby + NPC.localAI[1] = 0; + NPC.localAI[2] = 0; + NPC.localAI[3] = 2f; // Flag as alternating + + SoundEngine.PlaySound(ModeShiftSound with { Volume = 0.4f }); + NPC.netUpdate = true; + + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } + } + } + + else // Either rev, or death when above 55% + { + if (NPC.localAI[3] != 0f) // Standard ruby AI w/o alternating + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; // Become ruby + NPC.localAI[1] = 0; + NPC.localAI[2] = 0; + NPC.localAI[3] = 0f; // Set overall phase flag to normal + NPC.netUpdate = true; + } + } + + bool currentModeIsEmerald = NPC.localAI[0] == 1f; + + if (currentModeIsEmerald) + { + Lighting.AddLight(NPC.Center, 0f, 0.8f, 0f); + + if (NPC.ai[3] == 1f) + { + NPC.knockBackResist = 0f; + + if (NPC.ai[0] == 0f) + { + NPC.damage = 0; + + NPC.velocity *= 0.94f; + + NPC.ai[1] += 1f; + + float anglularSpeed = NPC.ai[1] / EmeraldChargeGateValue_Death; + anglularSpeed = 0.1f + anglularSpeed * 0.4f; + NPC.rotation += anglularSpeed * NPC.direction; + + if (NPC.ai[1] >= EmeraldChargeGateValue_Death) { - Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, JewelBoltDamage, 0f, Main.myPlayer); + for (int dusty = 0; dusty < 10; dusty++) + { + Vector2 dustVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 20f, -Vector2.UnitY) * Main.rand.NextFloat(-4f, -1f); + int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); + Main.dust[emerald].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[emerald].scale = 0.5f; + Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + SoundEngine.PlaySound(SoundID.Item38, NPC.Center); + + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; } } - else - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, JewelBoltDamage, 0f, Main.myPlayer); + else if (NPC.ai[0] == 1f) + { + NPC.damage = NPC.defDamage; + + float chargeSpeed = 22f; + NPC.velocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center + Main.player[NPC.target].velocity * 10f, -Vector2.UnitY) * chargeSpeed; // Slightly predictive + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.ForceNetUpdate(); + } + else if (NPC.ai[0] == 2f) + { + NPC.damage = NPC.defDamage; + + NPC.rotation += MathHelper.ToRadians(Math.Sign(NPC.velocity.X) * 15); + + CustomSprite spriteParticle = new CustomSprite(NPC.Center - NPC.velocity, NPC.velocity * 0.8f, 10, "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald", 1.2f, Color.DarkGreen.MultiplyRGBA(new Color(1f, 1f, 1f, 0f))); + spriteParticle.Rotation = NPC.rotation; + + GeneralParticleHandler.SpawnParticle(spriteParticle); + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= EmeraldChargeGateValue_Death) + { + NPC.damage = 0; + + for (int dusty = 0; dusty < 10; dusty++) + { + Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f); + int emerald = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emerald].velocity = dustVel * Main.rand.NextFloat(1f, 2f); + Main.dust[emerald].noGravity = true; + if (Main.rand.NextBool()) + { + Main.dust[emerald].scale = 0.5f; + Main.dust[emerald].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); + + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + + NPC.velocity = Vector2.Zero; + + if (isAlternatingPhase) + { + NPC.localAI[2]++; + if (NPC.localAI[2] >= 2) + { + NPC.localAI[0] = 0f; // Become ruby + NPC.localAI[1] = 0; // Reset ruby attack counter + NPC.localAI[2] = 0; // Reset emerald attack counter + + SoundEngine.PlaySound(ModeShiftSound with { Volume = 0.5f }); + NPC.netUpdate = true; + + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } + } + } + } + } + } + else + { + NPC.damage = 0; + + NPC.knockBackResist = 0.7f; + + NPC.rotation = NPC.velocity.X / 15f; + + float velocity = 5f; + float acceleration = 0.2f; + + if (NPC.position.Y > Main.player[NPC.target].position.Y - 200f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; + } + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 300f) + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; + } + + if (NPC.Center.X > Main.player[NPC.target].Center.X + 200f) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > 8f) + NPC.velocity.X = 8f; + } + if (NPC.Center.X < Main.player[NPC.target].Center.X - 200f) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -8f) + NPC.velocity.X = -8f; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= EmeraldChargePhaseGateValue) + { + NPC.ai[2] = 0f; + NPC.ai[3] = 1f; + NPC.netUpdate = true; + } + } + } + else // Ruby AI + { + Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f); + + NPC.rotation = NPC.velocity.X / 15f; + + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + { + CalamityUtils.CalamityTargeting(NPC, default); } - NPC.netUpdate = true; + float velocity = 5f; + float acceleration = 0.1f; + + if (NPC.position.Y > Main.player[NPC.target].position.Y - 350f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y -= acceleration; + + if (NPC.velocity.Y > velocity) + NPC.velocity.Y = velocity; + } + else if (NPC.position.Y < Main.player[NPC.target].position.Y - 450f) + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y *= 0.98f; + + NPC.velocity.Y += acceleration; + + if (NPC.velocity.Y < -velocity) + NPC.velocity.Y = -velocity; + } + + if (NPC.Center.X > Main.player[NPC.target].Center.X + 100f) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X -= acceleration; + + if (NPC.velocity.X > 8f) + NPC.velocity.X = 8f; + } + if (NPC.Center.X < Main.player[NPC.target].Center.X - 100f) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + + NPC.velocity.X += acceleration; + + if (NPC.velocity.X < -8f) + NPC.velocity.X = -8f; + } + + NPC.ai[0] += 1f; + if (NPC.ai[0] >= (death ? BoltShootGateValue_Death : BoltShootGateValue)) + { + NPC.ai[0] = 0f; + + Vector2 npcPos = NPC.Center; + float xDist = Main.player[NPC.target].Center.X - npcPos.X; + float yDist = Main.player[NPC.target].Center.Y - npcPos.Y; + Vector2 projVector = new Vector2(xDist, yDist); + float projLength = projVector.Length(); + + float speed = death ? 12f : 10f; + int type = ModContent.ProjectileType(); + + projLength = speed / projLength; + projVector.X *= projLength; + projVector.Y *= projLength; + + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } + + SoundEngine.PlaySound(ShootSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, JewelBoltDamage, 0f, Main.myPlayer); + + NPC.netUpdate = true; + + if (isAlternatingPhase) + { + NPC.localAI[1]++; + if (NPC.localAI[1] >= 4) + { + NPC.localAI[0] = 1f; // Become emerald + NPC.localAI[1] = 0; // Reset ruby attack counter + NPC.localAI[2] = 0; // Reset emerald attack counter + + SoundEngine.PlaySound(ModeShiftSound with { Volume = 0.5f }); + NPC.netUpdate = true; + + for (int i = 0; i < 6; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink)); + } + } + } + } } } @@ -181,24 +460,39 @@ namespace CalamityMod.NPCs.NormalNPCs float start = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < 3; i++) + { GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeRubyShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); + } + SoundEngine.PlaySound(ShatterSound, NPC.Center); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Color col = Color.Red; - Color flashCol = Color.Pink; + bool emeraldMode = NPC.localAI[0] == 1f; + + Color col = emeraldMode ? Color.DarkOliveGreen : Color.Red; + Color flashCol = emeraldMode ? Color.Lime : Color.Pink; float alph = 0f; + float currentLightTelegraphDuration = emeraldMode ? EmeraldLightTelegraphDuration : RubyLightTelegraphDuration; + float currentColorTelegraphGateValue = (emeraldMode ? EmeraldChargeGateValue_Death : BoltShootGateValue_Death) - currentLightTelegraphDuration; - float colorTelegraphGateValue = (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration; + if (emeraldMode) + { + if (NPC.ai[0] == 0f && NPC.ai[1] > currentColorTelegraphGateValue) + { + alph = MathHelper.Lerp(0f, 1f, (NPC.ai[1] - currentColorTelegraphGateValue) / currentLightTelegraphDuration); + } + } + else + { + if (NPC.ai[0] > currentColorTelegraphGateValue) + alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - currentColorTelegraphGateValue) / currentLightTelegraphDuration); + } - if (NPC.ai[0] > colorTelegraphGateValue) - alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); - - Asset tex = ModContent.Request(Texture); + Asset tex = ModContent.Request(emeraldMode ? "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald" : Texture); Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); @@ -207,6 +501,18 @@ namespace CalamityMod.NPCs.NormalNPCs return false; } + public override void FindFrame(int frameHeight) + { + bool emeraldMode = NPC.localAI[0] == 1f; + + if (emeraldMode) + { + NPC.frameCounter = 2; + } + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + public override Color? GetAlpha(Color drawColor) => Color.White; public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) @@ -220,6 +526,44 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int i = 0; i < 6; i++) GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red)); + + bool emeraldMode = NPC.localAI[0] == 1f; + if (emeraldMode) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + + if (NPC.life <= 0) + { + NPC.position = NPC.Center; + NPC.width = NPC.height = 45; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + + for (int i = 0; i < 2; i++) + { + int emeraldDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emeraldDust].noGravity = true; + Main.dust[emeraldDust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[emeraldDust].scale = 0.5f; + Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int j = 0; j < 10; j++) + { + int emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f); + Main.dust[emeraldDust2].noGravity = true; + Main.dust[emeraldDust2].velocity *= 5f; + emeraldDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f); + Main.dust[emeraldDust2].noGravity = true; + Main.dust[emeraldDust2].velocity *= 2f; + } + } + } } } } + diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs b/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs deleted file mode 100644 index fc02f5133c..0000000000 --- a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs +++ /dev/null @@ -1,280 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CalPlayer; -using CalamityMod.Events; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -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; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class KingSlimeJewelSapphire : ModNPC - { - private const int BuffDustGateValue = 60; - private const float LightTelegraphDuration = 45f; - - public override void SetStaticDefaults() - { - NPCID.Sets.NeedsExpertScaling[Type] = true; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); - } - - public override void SetDefaults() - { - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 0; - NPC.width = 32; - NPC.height = 32; - NPC.defense = 5; - NPC.DR_NERD(0.05f); - NPC.lifeMax = 120; - NPC.knockBackResist = 0.9f; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit5; - NPC.DeathSound = SoundID.NPCDeath15; - NPC.Calamity().VulnerableToSickness = false; - } - - public override void AI() - { - // Despawn - if (!CalamityPlayer.areThereAnyDamnBosses) - { - NPC.life = 0; - OnKill(); - NPC.active = false; - NPC.netUpdate = true; - return; - } - - Lighting.AddLight(NPC.Center, 0f, 0f, 0.8f); - - // Float around the player - NPC.rotation = NPC.velocity.X / 15f; - - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - CalamityUtils.CalamityTargeting(NPC, default); - } - - float velocity = 5f; - float acceleration = 0.1f; - - int distanceFromKingSlime = 1; - Vector2 kingSlimeCenter = NPC.Center; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.KingSlime) - { - distanceFromKingSlime = (int)NPC.Distance(Main.npc[i].Center); - kingSlimeCenter = Main.npc[i].Center; - break; - } - } - - Vector2 movementTarget = kingSlimeCenter == NPC.Center ? Main.player[NPC.target].Center : kingSlimeCenter; - if (NPC.position.Y > movementTarget.Y - 200f) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y -= acceleration; - - if (NPC.velocity.Y > velocity) - NPC.velocity.Y = velocity; - } - else if (NPC.position.Y < movementTarget.Y - 250f) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= 0.98f; - - NPC.velocity.Y += acceleration; - - if (NPC.velocity.Y < -velocity) - NPC.velocity.Y = -velocity; - } - - if (NPC.Center.X > movementTarget.X + 100f) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X -= acceleration; - - if (NPC.velocity.X > 8f) - NPC.velocity.X = 8f; - } - if (NPC.Center.X < movementTarget.X - 100f) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= 0.98f; - - NPC.velocity.X += acceleration; - - if (NPC.velocity.X < -8f) - NPC.velocity.X = -8f; - } - - // Emit buff dust - NPC.ai[0] += 1f; - if (NPC.ai[0] >= BuffDustGateValue) - { - NPC.ai[0] = 0f; - - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - - for (int dusty = 0; dusty < 10; dusty++) - { - Vector2 dustVel = (kingSlimeCenter - NPC.Center).SafeNormalize(Vector2.UnitY) * Main.rand.NextFloat(2f, 4f); - int sapphire = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); - Main.dust[sapphire].velocity = dustVel * Main.rand.NextFloat(1f, 2f); - Main.dust[sapphire].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[sapphire].scale = 0.5f; - Main.dust[sapphire].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - int maxDustIterations = distanceFromKingSlime; - int maxDust = 100; - int dustDivisor = maxDustIterations / maxDust; - if (dustDivisor < 2) - dustDivisor = 2; - - Vector2 dustLineStart = NPC.Center; - Vector2 dustLineEnd = kingSlimeCenter; - Vector2 currentDustPos = default; - Vector2 spinningpoint = new Vector2(0f, -1f).RotatedByRandom(MathHelper.Pi); - int dustSpawned = 0; - for (int i = 0; i < maxDustIterations; i++) - { - if (i % dustDivisor == 0) - { - currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDustIterations); - int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.GemSapphire, 0f, 0f, 100, default, 1f); - Main.dust[dust].position = currentDustPos; - Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxDustIterations) * (0.9f + Main.rand.NextFloat() * 0.2f); - Main.dust[dust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale *= 0.5f; - dust3 = dust2; - dust3.fadeIn *= 0.5f; - dustSpawned++; - } - } - - NPC.netUpdate = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - Color col = Color.BlueViolet; - Color flashCol = Color.LightSkyBlue; - - NPC.localAI[1]++; - - float alph = 0.4f + (float)(Math.Sin(NPC.localAI[1] / 30f) * 0.4f); - - Asset tex = ModContent.Request(Texture); - Asset tex2 = ModContent.Request("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash"); - - Main.EntitySpriteDraw(tex.Value, NPC.Center - screenPos, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); - Main.EntitySpriteDraw(tex2.Value, NPC.Center - screenPos, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None); - - return false; - } - - public override Color? GetAlpha(Color drawColor) - { - Color initialColor = new Color(100, 100, 175); - Color newColor = initialColor; - Color finalColor = new Color(150, 150, 255); - float colorTelegraphGateValue = BuffDustGateValue - LightTelegraphDuration; - if (NPC.ai[0] > colorTelegraphGateValue) - newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); - newColor.A = (byte)(255 * NPC.Opacity); - - return newColor; - } - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * balance); - } - - public override void OnKill() - { - for (int i = 0; i < 6; i++) - { - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.BlueViolet)); - GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.LightSkyBlue)); - } - - float start = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 3; i++) - GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeSapphireShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i)); - - SoundEngine.PlaySound(KingSlimeJewelRuby.ShatterSound, NPC.Center); - } - - public override bool CheckActive() => false; - - public override void HitEffect(NPC.HitInfo hit) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, hit.HitDirection, -1f, 0, default, 1f); - Main.dust[dust].noGravity = true; - - if (NPC.life <= 0) - { - NPC.position = NPC.Center; - NPC.width = NPC.height = 45; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int i = 0; i < 2; i++) - { - int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust].noGravity = true; - Main.dust[rubyDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[rubyDust].scale = 0.5f; - Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - for (int j = 0; j < 10; j++) - { - int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 3f); - Main.dust[rubyDust2].noGravity = true; - Main.dust[rubyDust2].velocity *= 5f; - rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust2].noGravity = true; - Main.dust[rubyDust2].velocity *= 2f; - } - } - } - } -} diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.png b/NPCs/NormalNPCs/KingSlimeJewelSapphire.png deleted file mode 100644 index 275d2722fa..0000000000 Binary files a/NPCs/NormalNPCs/KingSlimeJewelSapphire.png and /dev/null differ diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 9d828e3f88..c9d8f68bc4 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -28,8 +28,6 @@ namespace CalamityMod.NPCs.Polterghast public override void SetDefaults() { NPC.damage = 0; // No contact damage - NPC.aiStyle = -1; - AIType = -1; NPC.width = 30; NPC.height = 30; NPC.defense = 45; @@ -37,6 +35,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.noTileCollide = true; NPC.chaseable = false; NPC.lifeMax = 20000; + NPC.dontTakeDamage = true; NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs index d072498999..31c95cb07c 100644 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ b/NPCs/SunkenSea/CarrionSwallower.cs @@ -3,6 +3,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; @@ -44,8 +45,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.DD2_SkeletonDeath; NPC.noGravity = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs index 21f70be2af..71b6781d45 100644 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.SunkenSea bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); } } - Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool(), Main.rand.NextBool()); + Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool()); GeneralParticleHandler.SpawnParticle(bone); // Add to a list of bones bones.Add(bone); diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs index a0b1ebf8d9..10e0901da1 100644 --- a/NPCs/SunkenSea/HauntedChum.cs +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.BiomeManagers; using CalamityMod.DataStructures; using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -44,6 +45,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.noGravity = true; NPC.noTileCollide = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); } public override void AI() diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs index d9d6a532e0..5dd78c9a5e 100644 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.BiomeManagers; using CalamityMod.DataStructures; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; using CalamityMod.Systems; @@ -65,8 +66,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath3; NPC.chaseable = false; NPC.noTileCollide = true; - // Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs index e131646269..4b5185fdaf 100644 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -73,8 +73,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; diff --git a/NPCs/SunkenSea/LazarusLampfish.cs b/NPCs/SunkenSea/LazarusLampfish.cs index 0ea2671558..b07c3290e3 100644 --- a/NPCs/SunkenSea/LazarusLampfish.cs +++ b/NPCs/SunkenSea/LazarusLampfish.cs @@ -95,8 +95,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.1f; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); LegacyName this to the BlindedAngler banner when it exists + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; diff --git a/NPCs/SunkenSea/Leerslug.cs b/NPCs/SunkenSea/Leerslug.cs index 9e0692ce65..23cbd80253 100644 --- a/NPCs/SunkenSea/Leerslug.cs +++ b/NPCs/SunkenSea/Leerslug.cs @@ -61,8 +61,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath53; NPC.GravityIgnoresLiquid = true; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index 19d401715f..b337deb76b 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -61,8 +61,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath6; NPC.noTileCollide = true; NPC.alpha = 120; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = ItemID.AshBlock; // yeah this is intentional NPC.Calamity().VulnerableToHeat = false; diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs index 516f7b5d31..19020fbd18 100644 --- a/NPCs/SunkenSea/Pearlpod.cs +++ b/NPCs/SunkenSea/Pearlpod.cs @@ -63,8 +63,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath1; NPC.GravityIgnoresLiquid = true; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.catchItem = ItemType; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; @@ -371,6 +371,11 @@ namespace CalamityMod.NPCs.SunkenSea base.SetStaticDefaults(); Main.npcFrameCount[Type] = 4; } + public override void SetDefaults() + { + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + } public override float SpawnRate => 0.6f; public override int ItemType => ModContent.ItemType(); } @@ -382,7 +387,11 @@ namespace CalamityMod.NPCs.SunkenSea this.HideFromBestiary(); Main.npcFrameCount[Type] = 4; } - + public override void SetDefaults() + { + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + } public override float SpawnRate => 0.05f; public override int ItemType => ModContent.ItemType(); } @@ -394,6 +403,11 @@ namespace CalamityMod.NPCs.SunkenSea this.HideFromBestiary(); Main.npcFrameCount[Type] = 4; } + public override void SetDefaults() + { + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); + } public override float SpawnRate => 0.2f; public override int ItemType => ModContent.ItemType(); } diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs index 22b3f9f7c3..b94c75c3b6 100644 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ b/NPCs/SunkenSea/PodobooKoi.cs @@ -100,8 +100,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/Polyperil.cs b/NPCs/SunkenSea/Polyperil.cs index b2019f9781..2d8d8e235c 100644 --- a/NPCs/SunkenSea/Polyperil.cs +++ b/NPCs/SunkenSea/Polyperil.cs @@ -1,4 +1,5 @@ using CalamityMod.Enums; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -68,8 +69,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.value = Item.buyPrice(silver: 5); - // Banner = NPC.type; - // BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs index 78b9265cf9..6de1d47c01 100644 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ b/NPCs/SunkenSea/PrismaticGuppy.cs @@ -180,8 +180,8 @@ namespace CalamityMod.NPCs.SunkenSea AIType = -1; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); } diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index b734bfcad1..5fbc897d8f 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.netAlways = true; NPC.chaseable = false; Banner = NPC.type; - BannerItem = ModContent.ItemType(); + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs index 980e5e4919..05bf9df593 100644 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -96,8 +96,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath1; NPC.chaseable = false; NPC.netAlways = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs index 641900a856..fe6b33bb83 100644 --- a/NPCs/SunkenSea/Scavenger.cs +++ b/NPCs/SunkenSea/Scavenger.cs @@ -25,6 +25,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.Utilities; +using CalamityMod.Items.Placeables.Banners; namespace CalamityMod.NPCs.SunkenSea { @@ -290,8 +291,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; diff --git a/NPCs/SunkenSea/Searslug.cs b/NPCs/SunkenSea/Searslug.cs index ee7ee5e32e..0fd094a8f3 100644 --- a/NPCs/SunkenSea/Searslug.cs +++ b/NPCs/SunkenSea/Searslug.cs @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath1; NPC.GravityIgnoresLiquid = true; NPC.chaseable = false; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.catchItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; diff --git a/NPCs/SunkenSea/Slugbun.cs b/NPCs/SunkenSea/Slugbun.cs index 324dc3fbaf..6d74da0efc 100644 --- a/NPCs/SunkenSea/Slugbun.cs +++ b/NPCs/SunkenSea/Slugbun.cs @@ -77,8 +77,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath1; NPC.GravityIgnoresLiquid = true; NPC.chaseable = false; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.catchItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; diff --git a/NPCs/SunkenSea/Steampod.cs b/NPCs/SunkenSea/Steampod.cs index 606ff7c184..4da9fd2b3f 100644 --- a/NPCs/SunkenSea/Steampod.cs +++ b/NPCs/SunkenSea/Steampod.cs @@ -86,8 +86,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath1; NPC.chaseable = false; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToWater = true; NPC.Calamity().VulnerableToCold = true; diff --git a/NPCs/SunkenSea/StormlionSentry.cs b/NPCs/SunkenSea/StormlionSentry.cs index 7cadfdffe3..300a283a4a 100644 --- a/NPCs/SunkenSea/StormlionSentry.cs +++ b/NPCs/SunkenSea/StormlionSentry.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Dusts; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Magic; @@ -88,8 +89,8 @@ namespace CalamityMod.NPCs.SunkenSea attackFeedback = 1; headRot = -MathHelper.PiOver2; - //Banner = NPC.type; - //BannerItem = ModContent.ItemType(); + Banner = NPC.type; + BannerItem = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index cfdfcb7410..67541d7de9 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -131,42 +131,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Super fast spin and charges phase bool phase7 = lifeRatio < 0.1f; - // Spawn Creepers in Death Mode - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && death && phase3) - { - npc.localAI[0] = 2f; - SpawnDeathModeCreepers(); - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && death && phase5) - { - npc.localAI[0] = 3f; - SpawnDeathModeCreepers(); - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && death && phase7) - { - npc.localAI[0] = 4f; - SpawnDeathModeCreepers(); - } - - void SpawnDeathModeCreepers() - { - int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath() / 4; - float attackTimerIncrement = 15f * 4; - for (int i = 0; i < brainOfCthuluCreepersCount; i++) - { - float brainX = npc.Center.X; - float brainY = npc.Center.Y; - brainX += Main.rand.Next(-npc.width, npc.width); - brainY += Main.rand.Next(-npc.height, npc.height); - - int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, i * attackTimerIncrement); - Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); - Main.npc[creeperSpawn].netUpdate = true; - } - } - // Whether the fucking thing is spinning or not, dipshit bool spinning = npc.ai[0] == -4f; @@ -214,9 +178,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rubber band movement if (!despawn) { - float velocityScale = death ? 6f : 4.5f; + float velocityScale = death ? 5.5f : 4.5f; float velocityBoost = velocityScale * (1f - lifeRatio); - float nonChargeSpeed = (death ? 25.5f : 18f) + velocityBoost; + float nonChargeSpeed = (death ? 22f : 18f) + velocityBoost; if (Main.getGoodWorld) nonChargeSpeed *= 1.15f; @@ -304,7 +268,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; - float timer = (death ? 0f : 30f) + npc.ai[3]; + float timer = (death ? 20f : 30f) + npc.ai[3]; // Move the brain away from the target in order to ensure fairness if (npc.ai[2] >= timer - 5f) @@ -315,7 +279,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] -= 1f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * -chargeVelocity; if (death) - npc.velocity *= 1.5f; + npc.velocity *= 1.2f; if (Main.getGoodWorld) npc.velocity *= 1.15f; } @@ -325,7 +289,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] >= timer) { // Shoot projectiles from 4 directions, alternating between diagonal and cardinal - float bloodShotVelocity = death ? 8f : 6f; + float bloodShotVelocity = death ? 7f : 6f; // Scale projectile velocity float phase7ProjectileVelocityMult = 1.2f; @@ -393,40 +357,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses default: break; } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - position).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; - float minFiringDistance = 560f; // 35 tile distance - bool firedFromRealBrain = Vector2.Distance(position, npc.Center) < 8f; - if (Vector2.Distance(position, Main.player[npc.target].Center) > minFiringDistance && !firedFromRealBrain) // The projectiles can only be fired if the target is more than 15 tiles away from the firing position - { - bool canHit = Collision.CanHitLine(position, 1, 1, Main.player[npc.target].Center, 1, 1); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.BloodShot; - int numProj = death ? 9 : 4; - int spread = death ? 32 : 15; - if (phase7) - { - numProj = death ? 7 : 2; - spread = death ? 25 : 10; - } - else if (phase5) - { - numProj = death ? 8 : 3; - spread = death ? 40 : 20; - } - - float rotation = MathHelper.ToRadians(spread); - for (int j = 0; j < numProj; j++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), position + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, BloodShotDamage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 600; - if (!canHit) - Main.projectile[proj].tileCollide = false; - } - } - } } } @@ -435,22 +365,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.BloodNautilusShot; - int numProj = death ? 13 : 7; - int spread = death ? 60 : 40; + int numProj = death ? 9 : 7; + int spread = death ? 55 : 40; if (phase7) { - numProj = death ? 7 : 2; - spread = death ? 23 : 5; + numProj = death ? 3 : 2; + spread = death ? 10 : 5; } else if (phase5) { - numProj = death ? 8 : 2; - spread = death ? 30 : 10; + numProj = death ? 3 : 2; + spread = death ? 15 : 10; } else if (phase4) { - numProj = death ? 9 : 3; - spread = death ? 30 : 10; + numProj = death ? 6 : 3; + spread = death ? 25 : 10; } float rotation = MathHelper.ToRadians(spread); @@ -495,7 +425,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 22 : 30) : (death ? 45 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; npc.localAI[1] = 0f; npc.alpha = 0; @@ -648,7 +578,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - int maxRandomTime = phase7 ? (death ? 10 : 30) : (death ? 20 : 60); + int maxRandomTime = phase7 ? (death ? 22 : 30) : (death ? 45 : 60); npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; } else @@ -705,7 +635,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); - float maxMoveVelocity = (death ? 4f : 1.5f) + velocityScale; + float maxMoveVelocity = (death ? 1.9f : 1.5f) + velocityScale; // This used to be 4f in death. Yeah if (Main.getGoodWorld) maxMoveVelocity *= 2f; @@ -730,7 +660,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += (death ? 2f : 1f) + velocityScale; - if (npc.localAI[1] >= (death ? 540f : 360f)) + if (npc.localAI[1] >= (death ? 570f : 360f)) { // Teleport location npc.localAI[1] = 0f; @@ -865,8 +795,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Scale the aggressiveness of the charges with amount of Creepers remaining float chargeAggressionScale = creeperRatio <= 0.1f ? 1.75f : creeperRatio <= 0.2f ? 1.25f : creeperRatio <= 0.4f ? 0.875f : creeperRatio <= 0.6f ? 0.5f : creeperRatio <= 0.8f ? 0.25f : 0f; - if (death) - chargeAggressionScale *= 1.875f; // Give off blood dust before charging float beginTelegraphGateValue = TimeBeforeCreeperAttack - CreeperTelegraphTime; @@ -895,7 +823,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - float velocity = (death ? 17f : 8f) + chargeAggressionScale; + float velocity = (death ? 10f : 8f) + chargeAggressionScale; if (brainIsInPhase2) { float velocityFloor = Main.npc[NPC.crimsonBoss].velocity.Length() + velocity * 0.5f; @@ -950,7 +878,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Always fully visible while charging npc.alpha = 0; - float chargeVelocity = (death ? 13f : 6f) + chargeAggressionScale; + float chargeVelocity = (death ? 8f : 6f) + chargeAggressionScale; float returnToBrainGateValue = 1f; if (!brainIsInPhase2) { @@ -973,7 +901,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Return to Brain after a set time - float chargeDistance = death ? 900f : 600f; + float chargeDistance = death ? 800f : 600f; returnToBrainGateValue = chargeDistance / chargeVelocity; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 78436ec1da..1dbf0d7888 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static class DestroyerAI { public const float DRIncreaseTime = 600f; - public const float DeathModeLaserBreathGateValue = 600f; + public const float DeathModeLaserBreathGateValue = 800f; public const float LaserTelegraphTime = 120f; public const float SparkTelegraphTime = 30f; public const float FlightPhaseGateValue = 900f; @@ -197,19 +197,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int noFlyZoneBoxHeight = death ? 1500 : 1800; // Speed and movement variables - float speed = death ? 0.2f : 0.1f; - float turnSpeed = death ? 0.3f : 0.15f; + float speed = death ? 0.12f : 0.1f; + float turnSpeed = death ? 0.18f : 0.15f; // Max velocity - float segmentVelocity = flyAtTarget ? (death ? 22.5f : 15f) : (death ? 30f : 20f); + float segmentVelocity = flyAtTarget ? 15f : 20f; // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); - float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); - float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + float segmentVelocityBoost = death ? (flyAtTarget ? 4f : 5.25f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.10f : 0.135f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.15f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); segmentVelocity += segmentVelocityBoost; speed += speedBoost; @@ -237,45 +237,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } bool probeLaunched = npc.ai[2] == 1f; - if (npc.type == NPCID.TheDestroyerBody) - { - // Regenerate Probes in Death Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) - if (death && probeLaunched) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 600f) - { - int maxProbes = 40; - bool regenerateProbeSegment = NPC.CountNPCS(NPCID.Probe) < maxProbes; - if (regenerateProbeSegment) - { - int maxNPCs = totalSegments + maxProbes; - int numNPCs = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - numNPCs++; - if (numNPCs >= maxNPCs) - { - regenerateProbeSegment = false; - break; - } - } - } - } - - if (regenerateProbeSegment) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - npc.localAI[2] = 0f; - npc.SyncVanillaLocalAI(); - } - } - } if (npc.type == NPCID.TheDestroyer) { @@ -301,76 +262,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses index = segment; } } - - // Laser breath in Death Mode - if (spitLaserSpreads) - { - // Set laser color and type - if (calamityGlobalNPC.destroyerLaserColor == -1) - { - calamityGlobalNPC.destroyerLaserColor = phase3 ? 3 : phase2 ? 2 : 1; - npc.SyncDestroyerLaserColor(); - } - - float laserBreathGateValue = DeathModeLaserBreathGateValue; - if (calamityGlobalNPC.newAI[0] < laserBreathGateValue) - calamityGlobalNPC.newAI[0] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Sync newAI every 20 frames for the new telegraph - if (calamityGlobalNPC.newAI[0] % 20f == 10f) - npc.SyncExtraAI(); - } - - if ((player.Center - npc.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(npc.velocity.ToRotation(), MathHelper.PiOver4) == npc.velocity.ToRotation() && - calamityGlobalNPC.newAI[0] >= laserBreathGateValue && Vector2.Distance(npc.Center, player.Center) > 480f && - Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (calamityGlobalNPC.newAI[0] % 30f == 0f) - { - float velocity = death ? 5.333f : 5f; - int type = ProjectileID.DeathLaser; - switch (calamityGlobalNPC.destroyerLaserColor) - { - default: - case 0: - break; - - case 1: - type = ModContent.ProjectileType(); - break; - - case 2: - type = ModContent.ProjectileType(); - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = calamityGlobalNPC.newAI[0] % 60f == 0f ? (death ? 9 : 7) : (death ? 6 : 4); - int spread = death ? 38 : 26; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 100f, perturbedSpeed, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 1200; - } - } - } - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > laserBreathGateValue + 60f) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.destroyerLaserColor = -1; - npc.SyncDestroyerLaserColor(); - npc.SyncExtraAI(); - } - } - } } // Fire lasers @@ -406,7 +297,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser rate of fire - float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; + float shootProjectileTime = death ? (phase5 ? 350f : phase4 ? 400f : 450f) : 450f; if (ableToFireLaser) calamityGlobalNPC.newAI[0] += 1f; @@ -655,7 +546,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.type == NPCID.TheDestroyerBody) { - float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; + float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 400f : 450f; float telegraphGateValue = shootProjectileTime - LaserTelegraphTime; if (calamityGlobalNPC.newAI[0] > telegraphGateValue) { @@ -986,7 +877,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; - float velocity = death ? 8.4f : 7.2f; + float velocity = death ? 8.15f : 7.2f; float acceleration = death ? 0.07f : 0.06f; float deceleration = 1f - acceleration; @@ -1096,7 +987,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Type != 0 && Collision.CanHit(npc.position, npc.width, npc.height, targetData.Position, targetData.Width, targetData.Height)) { int type = ProjectileID.PinkLaser; - int totalProjectiles = death ? 3 : 1; + int totalProjectiles = 1; Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index a6c99486c7..c40345c259 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -24,7 +24,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Variables bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - bool deathModeSurprise = lifeRatio >= 0.9f && death; bool phase2 = lifeRatio < (death ? 0.6f : 0.7f); bool phase3 = lifeRatio < (death ? 0.3f : 0.4f); bool phase4 = lifeRatio < (death ? 0.1f : 0.2f); @@ -86,7 +85,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses idlePhaseAcceleration *= 1.05f; idlePhaseVelocity *= 1.08f; chargeTime -= 1; - chargeVelocity *= 1.13f; + chargeVelocity *= 1.1f; } if (Main.getGoodWorld) @@ -181,18 +180,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - idlePhaseTimer -= 6; - idlePhaseAcceleration *= 1.2f; - idlePhaseVelocity *= 1.2f; - chargeTime -= 4; - chargeVelocity += 3f; + chargeTime -= 2; + chargeVelocity += 1f; } if (Main.getGoodWorld) chargeTime += Main.rand.Next(5, 66); // Spawn cthulhunadoes in phase 3 - if (phase3AI && ((!phase4 && !deathModeSurprise) || Main.getGoodWorld)) + if (phase3AI && ((!phase4) || Main.getGoodWorld)) { calamityGlobalNPC.newAI[0] += 1f; float timeGateValue = 600f; @@ -215,7 +211,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = deathModeSurprise ? 9f : -1f; + npc.ai[0] = -1f; npc.netUpdate = true; } } @@ -414,7 +410,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrage) npc.ai[2] = sharknadoPhaseTimer - 40; else if (death) - npc.ai[2] = sharknadoPhaseTimer - 60; + npc.ai[2] = sharknadoPhaseTimer - 40; } // Go to phase 2 @@ -906,10 +902,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Go back to normalcy after dropping below 90% HP - if (!deathModeSurprise && !phase3) - phase3AttackPicker = 3; - // Set velocity for charge if (phase3AttackPicker == 1) { @@ -977,21 +969,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[phase3ChargeDust].velocity -= npc.velocity; } - // Spawn bubbles during charge in Master Mode (these bubbles have special behavior that makes them float upward, doing no damage, before returning to their normal behavior) - if (death && phase4) - { - if (npc.ai[2] % (bubbleBelchPhaseDivisor * 2) == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 bubbleSpawnDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - NPC.NewNPC(npc.GetSource_FromAI(), (int)bubbleSpawnDirection.X, (int)bubbleSpawnDirection.Y + 45, NPCID.DetonatingBubble, 0, 0f, -60f); - } - } - } - npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 5a5ab61042..853263916d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -741,7 +741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool expertAttack = calamityGlobalNPC.newAI[2] == 0f; int numLanceWalls = expertAttack ? 6 : 4; - float lanceWallSpawnGateValue = expertAttack ? 36f : 54f; + float lanceWallSpawnGateValue = expertAttack ? (death ? 42f : 36f) : 54f; if (dayTimeEnrage) lanceWallSpawnGateValue -= expertAttack ? 4f : 6f; @@ -769,7 +769,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lanceWallSizeMult = 1.4f; totalProjectiles += 5f; lanceSpacing += 50f; - lanceWallSize *= (death ? 0.75f : 0.5f); + lanceWallSize *= (death ? 0.7f : 0.5f); float direction = 1f; int randomLanceWallType; @@ -1023,7 +1023,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn Ethereal Lances ahead of the target. case 11: - // Avoid cheap bullshit. npc.damage = 0; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index a5cd8b3f9e..4156e5d6d5 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.player[npc.target].dead) npc.ai[3] += 1f; - float servantSpawnGateValue = death ? 10f : 40f; + float servantSpawnGateValue = death ? 15f : 40f; if (Main.getGoodWorld) servantSpawnGateValue *= 0.8f; @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 servantSpawnVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * servantAndProjectileVelocity; Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; - int maxServants = 4; + int maxServants = 3; bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; if (spawnServant) SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); @@ -300,7 +300,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += phaseChangeRate; if (npc.ai[1] % servantSpawnGateValue == 0f) { - float servantVelocity = death ? 11.3f : 5.65f; + float servantVelocity = death ? 9.3f : 5.65f; Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity); if (Main.getGoodWorld) servantSpawnVelocity *= 3f; @@ -414,7 +414,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int type = ProjectileID.BloodNautilusShot; int numProj = 3; - int spread = 10; + int spread = 18; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index d9d895141c..c0c501dff7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -14,17 +14,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static class KingSlimeAI { public static readonly SoundStyle SpawnCrystalSound = new SoundStyle("CalamityMod/Sounds/Custom/KingSlimeJewelSpawn"); - - // Death exclusive - public static float SapphireJewelContactDamageMult = 1.5f; // 144 + public static readonly SoundStyle ShootSound = new SoundStyle("CalamityMod/Sounds/Custom/RedJewelFire"); public static bool BuffedKingSlimeAI(NPC npc, Mod mod) { - // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; float lifeRatio2 = lifeRatio; - // Variables float teleportScale = 1f; bool teleporting = false; bool teleported = false; @@ -38,169 +34,52 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - // Phases based on life percentage - // Higher velocity jumps phase bool phase2 = lifeRatio < 0.75f; - // Spawn Emerald Crystal phase - bool spawnGreenCrystal = lifeRatio < 0.7f; + // In death: 75-55 = ruby, 50-35 = emerald, 35-0 = switches back and forth + bool rubySpawnPhaseActive = death ? (lifeRatio < 0.75f) : (lifeRatio < 0.5f); - // Spawn Ruby Crystal phase - bool phase3 = lifeRatio < 0.5f; + bool redCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); - // Spawn Sapphire Crystal phase - bool spawnBlueCrystal = lifeRatio < 0.3f; + // npc.Calamity().newAI[0] as a flag for Ruby spawn state: 0f = can spawn, 1f = spawned + bool rubySpawnedForCurrentPhase = npc.Calamity().newAI[0] == 1f; - // Check if the crystals are alive - bool redCrystalAlive = true; - bool blueCrystalAlive = false; - bool greenCrystalAlive = true; - - if (spawnGreenCrystal) - { - if (death) - greenCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); - } - - if (phase3) - redCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); - - if (spawnBlueCrystal) - { - if (death) - blueCrystalAlive = NPC.AnyNPCs(ModContent.NPCType()); - } - - // Sapphire Crystal buffs - int setDamage = npc.defDamage; + int setDamage = npc.defDamage; // Defined externally npc.defense = npc.defDefense; - if (blueCrystalAlive) - { - setDamage = (int)Math.Round(setDamage * SapphireJewelContactDamageMult); - npc.defense *= 2; - } - // Dust color when the blue crystal is alive - Color dustColor = Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); - - // Death Mode Crystal spawning - if (death) + if (rubySpawnPhaseActive && !redCrystalAlive && !rubySpawnedForCurrentPhase) { - if (spawnGreenCrystal && npc.Calamity().newAI[0] == 0f) + npc.Calamity().newAI[0] = 1f; + npc.SyncExtraAI(); + + Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; + int totalDustPerCrystalSpawn = 20; + for (int i = 0; i < totalDustPerCrystalSpawn; i++) { - npc.Calamity().newAI[0] = 1f; - npc.SyncExtraAI(); - Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; - int totalDustPerCrystalSpawn = 20; - for (int i = 0; i < totalDustPerCrystalSpawn; i++) + int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemRuby, 0f, 0f, 100, default, 2f); + Main.dust[rubyDust].velocity *= 2f; + Main.dust[rubyDust].noGravity = true; + if (Main.rand.NextBool()) { - int emeraldDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemEmerald, 0f, 0f, 100, default, 2f); - Main.dust[emeraldDust].velocity *= 2f; - Main.dust[emeraldDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[emeraldDust].scale = 0.5f; - Main.dust[emeraldDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); - Main.npc[jewel].localAI[2] = npc.whoAmI; - Main.npc[jewel].velocity.Y = -6; + Main.dust[rubyDust].scale = 0.5f; + Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (phase3 && npc.Calamity().newAI[0] == 1f) + SoundEngine.PlaySound(SpawnCrystalSound with { Volume = 2f }, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.Calamity().newAI[0] = 2f; - npc.SyncExtraAI(); - Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; - int totalDustPerCrystalSpawn = 20; - for (int i = 0; i < totalDustPerCrystalSpawn; i++) - { - int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust].velocity *= 2f; - Main.dust[rubyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[rubyDust].scale = 0.5f; - Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); - Main.npc[jewel].localAI[2] = npc.whoAmI; - Main.npc[jewel].velocity.Y = -6; - } - } - - if (spawnBlueCrystal && npc.Calamity().newAI[0] == 2f) - { - npc.Calamity().newAI[0] = 3f; - npc.SyncExtraAI(); - Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; - int totalDustPerCrystalSpawn = 20; - for (int i = 0; i < totalDustPerCrystalSpawn; i++) - { - int sapphireDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemSapphire, 0f, 0f, 100, default, 2f); - Main.dust[sapphireDust].velocity *= 2f; - Main.dust[sapphireDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[sapphireDust].scale = 0.5f; - Main.dust[sapphireDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); - Main.npc[jewel].localAI[2] = npc.whoAmI; - Main.npc[jewel].velocity.Y = -6; - } + int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + Main.npc[jewel].localAI[2] = npc.whoAmI; + Main.npc[jewel].velocity.Y = -6; } } - else + else if (rubySpawnedForCurrentPhase && !rubySpawnPhaseActive) { - // Spawn crystal in phase 2 - if (phase3 && npc.Calamity().newAI[0] == 0f) - { - npc.Calamity().newAI[0] = 1f; - npc.SyncExtraAI(); - Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2) * npc.scale; - int totalDustPerCrystalSpawn = 20; - for (int i = 0; i < totalDustPerCrystalSpawn; i++) - { - int rubyDust = Dust.NewDust(vector, npc.width / 2, npc.height / 2, DustID.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust].velocity *= 2f; - Main.dust[rubyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[rubyDust].scale = 0.5f; - Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int jewel = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); - Main.npc[jewel].localAI[2] = npc.whoAmI; - Main.npc[jewel].velocity.Y = -6; - } - } + npc.Calamity().newAI[0] = 0f; + npc.SyncExtraAI(); } // Set up health value for spawning slimes @@ -243,7 +122,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Faster fall if (npc.velocity.Y > 0f) { - float fallSpeedBonus = (death ? 0.15f : 0f) + (!redCrystalAlive ? 0.1f : 0f); + float fallSpeedBonus = (death ? 0.1f : 0f) + (!redCrystalAlive ? 0.1f : 0f); npc.velocity.Y += fallSpeedBonus; } @@ -251,7 +130,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float teleportGateValue = 480f; if (!Main.player[npc.target].dead && npc.ai[2] >= teleportGateValue && npc.ai[1] < 5f && npc.velocity.Y == 0f) { - // Avoid cheap bullshit npc.damage = 0; npc.ai[2] = 0f; @@ -283,7 +161,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleporting = false; } - // Get closer to activating teleport + // Closer to activating teleport if (npc.ai[2] < teleportGateValue) { if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > (death ? 160f : 320f)) @@ -292,7 +170,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; } - // Slow down dramatically while teleporting + // Slow down while teleporting if (npc.ai[1] == 5f || npc.ai[1] == 6f) { if (Math.Abs(npc.velocity.X) > 0.1f) @@ -306,12 +184,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Teleport if (npc.ai[1] == 5f) { - // Avoid cheap bullshit npc.damage = 0; teleporting = true; npc.aiAction = 1; - + float teleportRate = redCrystalAlive ? 1f : 2f; if (death) teleportRate *= 2f; @@ -325,7 +202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] >= 60f) teleported = true; - if (npc.ai[0] == 60f && !Main.dedServ) + if (npc.ai[0] == 60f && !Main.dedServ) Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) @@ -346,9 +223,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int i = 0; i < 10; i++) { - int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f); + int slimeDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); Main.dust[slimeDust].noGravity = true; - Main.dust[slimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f; + Main.dust[slimeDust].velocity *= 0.5f; } } } @@ -356,7 +233,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Post-teleport else if (npc.ai[1] == 6f) { - // Avoid cheap bullshit npc.damage = 0; teleporting = true; @@ -366,37 +242,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) teleportRate *= 2f; - if (npc.ai[0] == 0f) - { - // Move Blue Crystal - if (blueCrystalAlive) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC blueCrystal = Main.npc[i]; - if (blueCrystal.active && blueCrystal.type == ModContent.NPCType()) - { - blueCrystal.position.X = npc.position.X; - blueCrystal.position.Y = npc.position.Y - 200f; - - for (int dusty = 0; dusty < 10; dusty++) - { - Vector2 dustVel = Main.rand.NextVector2CircularEdge(5f, 5f); - int sapphire = Dust.NewDust(blueCrystal.Center, blueCrystal.width, blueCrystal.height, DustID.GemSapphire, 0f, 0f, 100, default, 2f); - Main.dust[sapphire].velocity = dustVel * Main.rand.NextFloat(1f, 2f); - Main.dust[sapphire].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[sapphire].scale = 0.5f; - Main.dust[sapphire].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - break; - } - } - } - } npc.ai[0] += teleportRate; teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); @@ -423,9 +268,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int j = 0; j < 10; j++) { - int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 150, blueCrystalAlive ? dustColor : new Color(78, 136, 255, 80), 2f); + int slimyDust = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); Main.dust[slimyDust].noGravity = true; - Main.dust[slimyDust].velocity *= blueCrystalAlive ? 0f : 2f; + Main.dust[slimyDust].velocity *= 2f; } } @@ -434,7 +279,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Jump if (npc.velocity.Y == 0f) { - // Avoid cheap bullshit npc.damage = 0; npc.velocity.X *= 0.8f; @@ -446,7 +290,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] += MathHelper.Lerp(1f, 8f, 1f - lifeRatio); if (npc.ai[0] >= 0f) { - // Set damage npc.damage = setDamage; npc.netUpdate = true; @@ -461,44 +304,36 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (speedMult > 2f) speedMult = 2f; - bool deathModeRapidHops = death && lifeRatio < 0.3f; + bool deathModeRapidHops = death && lifeRatio < 0.2f; if (deathModeRapidHops) npc.ai[1] = 2f; - // Jump type if (npc.ai[1] == 3f) { npc.velocity.Y = -10f * speedMult; - npc.velocity.X += (phase2 ? (death ? 5.5f : 4.5f) : 3.5f) * npc.direction; + npc.velocity.X += (phase2 ? (death ? 5.35f : 4.5f) : 3.5f) * npc.direction; npc.ai[0] = -100f; npc.ai[1] = 0f; } else if (npc.ai[1] == 2f) { npc.velocity.Y = -6f * speedMult; - npc.velocity.X += (phase2 ? (deathModeRapidHops ? 8f : death ? 6.5f : 5.5f) : 4.5f) * npc.direction; + npc.velocity.X += (phase2 ? (deathModeRapidHops ? 7.65f : death ? 6.25f : 5.5f) : 4.5f) * npc.direction; npc.ai[0] = -60f; - // Use the quick forward jump over and over while at low HP in death mode if (!deathModeRapidHops) npc.ai[1] += 1f; } else { npc.velocity.Y = -8f * speedMult; - npc.velocity.X += (phase2 ? (death ? 6f : 5f) : 4f) * npc.direction; + npc.velocity.X += (phase2 ? (death ? 5.75f : 5f) : 4f) * npc.direction; npc.ai[0] = -60f; npc.ai[1] += 1f; } - if (!greenCrystalAlive) - { - npc.velocity.X *= 1.2f; - npc.velocity.Y *= 0.6f; - } - if (death) - npc.velocity.X *= 1.4f; + npc.velocity.X *= 1.2f; npc.noTileCollide = true; } @@ -507,12 +342,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Change jump velocity - else if (npc.target < Main.maxPlayers) + else if (npc.target < Main.maxPlayers) // Velocity factoring { float jumpVelocityLimit = redCrystalAlive ? 3f : 4.5f; if (death) - jumpVelocityLimit += 3f; + jumpVelocityLimit += 2.25f; if (Main.getGoodWorld) jumpVelocityLimit = 8f; @@ -522,7 +356,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.velocity.X += (death ? 0.25f : 0.2f) * npc.direction; if (death) - npc.velocity.X += 0.3f * npc.direction; + npc.velocity.X += 0.25f * npc.direction; } else { @@ -543,19 +377,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, blueCrystalAlive ? DustID.GemSapphire : DustID.TintableDust, npc.velocity.X, npc.velocity.Y, blueCrystalAlive ? 100 : 255, blueCrystalAlive ? dustColor : new Color(0, 80, 255, 80), npc.scale * 1.2f); + int idleSlimeDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); Main.dust[idleSlimeDust].noGravity = true; - Main.dust[idleSlimeDust].velocity *= blueCrystalAlive ? 0f : 0.5f; + Main.dust[idleSlimeDust].velocity *= 0.5f; if (npc.life <= 0) return false; - // Adjust size based on HP + // Adjust size based on max health float maxScale = Main.getGoodWorld ? 3f : death ? 2.5f : 1.5f; - float minScale = death ? 0.5f : 0.75f; + float minScale = 0.75f; float maxScaledValue = maxScale - minScale; - // Inversed scale in FTW + // Inverse scaling in FTW if (Main.getGoodWorld) lifeRatio = (maxScaledValue - lifeRatio * maxScaledValue) + minScale; else @@ -573,7 +407,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.position.Y -= npc.height; } - // Slime spawning if (Main.netMode != NetmodeID.MultiplayerClient) { int slimeSpawnThreshold = (int)(npc.lifeMax * 0.03); @@ -620,19 +453,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((Main.raining && Main.hardMode) && Main.rand.NextBool(50)) npcType = NPCID.RainbowSlime; - if (death) + if (death) // 50% chance to spawn a spiked slime instead of the above npcType value { - switch (Main.rand.Next(3)) + if (Main.rand.NextBool()) { - case 0: - npcType = NPCID.SlimeSpiked; - break; - case 1: - npcType = NPCID.SpikedIceSlime; - break; - case 2: - npcType = NPCID.SpikedJungleSlime; - break; + npcType = Main.player[npc.target].ZoneJungle ? NPCID.SpikedJungleSlime : Main.player[npc.target].ZoneSnow ? NPCID.SpikedIceSlime : NPCID.SlimeSpiked; } } @@ -722,7 +547,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Default teleport if the above conditions aren't met in 100 iterations if (teleportTries >= 100) { Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index f6c6d16f79..ae415f485e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -58,6 +58,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + if (death) + aggressionLevel = 5; if (Main.getGoodWorld) aggressionLevel = 6; @@ -198,7 +200,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 targetDistance = Main.player[npc.target].Center - npc.Center; if (targetDistance.Length() > 20f) { - float velocity = death ? 9.5f : 9.25f; + float velocity = 9.25f; switch (aggressionLevel) { case 6: @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 targetDistanceVulnerable = Main.player[npc.target].Center - npc.Center; if (targetDistanceVulnerable.Length() > 20f) { - float velocity = death ? 9.5f : 9.25f; + float velocity = 9.25f; switch (aggressionLevel) { case 6: @@ -753,8 +755,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (calamityGlobalNPC.newAI[1] == 0f) { calamityGlobalNPC.newAI[1] = 420f; - if (death) - calamityGlobalNPC.newAI[1] -= 60f; switch (aggressionLevel) { @@ -920,7 +920,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 boltDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), boltAndDeathrayVector * npc.localAI[1]); - float velocity = death ? 6.75f : 6.25f; + float velocity = 6.25f; switch (aggressionLevel) { case 6: @@ -1068,7 +1068,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { handMovementDirection.Normalize(); - float velocity = death ? 7.75f : 7.5f; + float velocity = 7.5f; switch (aggressionLevel) { case 6: @@ -1151,7 +1151,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 handAttackRotation = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), handBehaviorVector * npc.localAI[1]); Vector2 handAttackMovement = npc.Center + Vector2.Normalize(handAttackRotation) * handBehaviorVector.Length() * 0.4f + handAttackVector; - float velocity = death ? 3.5f : 3f; + float velocity = 3f; switch (aggressionLevel) { case 6: @@ -1201,7 +1201,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses sphereHandDirection += new Vector2(handFaceDirection * 100f, -50f); Vector2 sphereHandDirectionMaxBound = new Vector2(400f * handFaceDirection, -60f); - float velocityMultiplier = death ? 0.88f : 0.885f; + float velocityMultiplier = 0.885f; switch (aggressionLevel) { case 6: @@ -1233,7 +1233,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 sphereHandTravelDist = sphereHandTravelVelocity; sphereHandTravelDist.Normalize(); - float velocity = death ? 11f : 10f; + float velocity = 10f; switch (aggressionLevel) { case 6: @@ -1307,7 +1307,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 handSmoothMoveNormalize = handSmoothMovement; handSmoothMoveNormalize.Normalize(); - float velocity = death ? 26.5f : 24f; + float velocity = 24f; switch (aggressionLevel) { case 6: @@ -1360,7 +1360,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (float.IsNaN(sphereVelocity.X) || float.IsNaN(sphereVelocity.Y)) sphereVelocity = Vector2.UnitY; - float velocity = death ? 2.2f : 2f; + float velocity = 2f; switch (aggressionLevel) { case 6: @@ -1402,7 +1402,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 handPauseDirection = handPauseSmoothSpeed; handPauseDirection.Normalize(); - float velocity = death ? 19.75f : 17.5f; + float velocity = 17.5f; switch (aggressionLevel) { case 6: @@ -1439,7 +1439,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 handReturnDirection = handReturnSmoothSpeed; handReturnDirection.Normalize(); - float velocity = death ? 11f : 10f; + float velocity = 10f; switch (aggressionLevel) { case 6: @@ -1516,7 +1516,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 boltShootDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), handBehaviorVector * npc.localAI[1]); - float velocity = death ? 6.75f : 6.25f; + float velocity = 6.25f; switch (aggressionLevel) { case 6: @@ -1708,7 +1708,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); - float velocity = death ? 38f : 36f; + float velocity = 36f; Vector2 freeEyeCenter = npc.Center; Vector2 freeEyeTargetCenter = Main.player[npc.target].Center; Vector2 freeEyeTargetDistance = freeEyeTargetCenter - freeEyeCenter; @@ -1780,7 +1780,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((secondAttackTimer == secondAttackPicker - 14f || secondAttackTimer == secondAttackPicker - 7f || secondAttackTimer == secondAttackPicker) && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 freeEyeBoltDirection = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), thirtyVector * npc.localAI[1]); - float velocity = death ? 9f : 8f; + float velocity = 8f; Vector2 freeEyeBoltVel = Vector2.Normalize(v8) * velocity; int type = ProjectileID.PhantasmalBolt; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeBoltDirection.X, npc.Center.Y + freeEyeBoltDirection.Y, freeEyeBoltVel.X, freeEyeBoltVel.Y, type, TrueEyeBoltDamage, 0f, Main.myPlayer, 0f, 0f); @@ -1858,7 +1858,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (trueEyeSphereDirection.HasNaNs()) trueEyeSphereDirection = Vector2.UnitY * -1f; - float spreadVelocity = death ? 4.5f : 4f; trueEyeSphereDirection *= 4f; int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeRotation.X, npc.Center.Y + freeEyeRotation.Y, trueEyeSphereDirection.X, trueEyeSphereDirection.Y, type, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); Main.projectile[proj].timeLeft = 1200; @@ -1915,7 +1914,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (secondAttackTimer == 105f) npc.netUpdate = true; - float velocity = death ? 13.25f : 12f; + float velocity = 12f; Vector2 trueEyeSphereVelocity = (npc.ai[2] - MathHelper.PiOver2).ToRotationVector2() * velocity; npc.velocity = trueEyeSphereVelocity * 2f; @@ -1999,7 +1998,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((secondAttackTimer - 15f - 30f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 trueEyeEyeDirection = npc.Center + Vector2.Normalize(trueEyeDirection) * thirtyVector.Length() * 0.4f; - float velocity = death ? 6f : 5f; + float velocity = 5f; Vector2 trueEyeEyeSpeed = Vector2.Normalize(trueEyeDirection) * velocity; float ai3 = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * npc.ai[2]; int type = ProjectileID.PhantasmalEye; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index 8093a7ec60..84c7cc0ef4 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -63,7 +63,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool useNewGatlingAttackVariant = addSporeGasBlastToGatlingAttack && death; bool phase2 = lifeRatio <= phase2LifeRatio; bool phase3 = lifeRatio < 0.35f; - bool vomitFreeTentacles = lifeRatio < 0.25f && death; bool phase4 = lifeRatio < 0.2f; npc.damage = (int)Math.Round(ContactDamageCorrection * (phase2 ? Phase2ContactDamageMult : 1f)); @@ -174,8 +173,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - velocity += velocity * 0.35f * (1f - lifeRatio); - acceleration += acceleration * 0.35f * (1f - lifeRatio); + velocity += velocity * 0.35f * ((1f - lifeRatio) / 2); + acceleration += acceleration * 0.35f * ((1f - lifeRatio) / 2); if (phase2) { float aggressionScale = (phase2LifeRatio - lifeRatio) / phase2LifeRatio; @@ -407,13 +406,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] -= timeToDecelerateDecrement; if (npc.ai[3] <= StopChargeGateValue) { - bool canChargeAgain = phase4 ? true : phase3 ? Main.rand.NextBool() : false; + bool canChargeAgain = phase4 || (phase3 && Main.rand.NextBool()); bool chargeAgain = canChargeAgain && death && calamityGlobalNPC.newAI[2] == 0f; npc.ai[3] = chargeAgain ? -2f : 0f; calamityGlobalNPC.newAI[2] = (death && calamityGlobalNPC.newAI[2] == 0f && chargeAgain) ? 1f : 0f; npc.SyncExtraAI(); - if (!vomitFreeTentacles && !secondCharge) + if (!secondCharge) { // Spawn a few tentacles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -563,7 +562,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses maxDistanceFromHooks += 150f; if (death) { - maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * (1f - lifeRatio); + maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * ((1f - lifeRatio) / 2); maxDistanceFromHooks += 200f; } @@ -647,7 +646,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.getGoodWorld) npc.localAI[1] += 1f; - float shootProjectileGateValue = death ? 30f : 60f; + float shootProjectileGateValue = death ? 40f : 60f; if (npc.localAI[1] >= shootProjectileGateValue) { npc.localAI[1] = 0f; @@ -723,7 +722,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 1f) { npc.localAI[0] = 2f; - int totalTentacles = death ? 12 : 8; + int totalTentacles = death ? 11 : 8; if (Main.getGoodWorld) totalTentacles *= 2; @@ -799,9 +798,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int type = ProjectileID.PoisonSeedPlantera; int damage = PoisonSeedDamage; float rotation = MathHelper.ToRadians(spread); - bool vomitTentacles = vomitFreeTentacles && NPC.CountNPCS(ModContent.NPCType()) < maxTentaclesAfterFirstTentaclePhase; - if (vomitTentacles) - SoundEngine.PlaySound(SoundID.NPCDeath11, npc.Center); for (int i = 0; i < numProj; i++) { @@ -817,7 +813,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 spawnOffset = npc.Center + perturbedSpeed * 50f; - int dustType = (shootPinkSeed && !vomitTentacles) ? 73 : 74; + int dustType = shootPinkSeed ? 73 : 74; Vector2 dustVelocity = perturbedSpeed * projectileSpeed; for (int k = 0; k < 5; k++) { @@ -827,17 +823,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (vomitTentacles) - { - int tentacle = NPC.NewNPC(npc.GetSource_FromAI(), (int)spawnOffset.X, (int)spawnOffset.Y, ModContent.NPCType(), 0, 120f, projectileSpeed); - Main.npc[tentacle].velocity.X = (perturbedSpeed * projectileSpeed * 0.5f).X; - Main.npc[tentacle].velocity.Y = (perturbedSpeed * projectileSpeed * 0.5f).Y; - Main.npc[tentacle].netUpdate = true; - } - else - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.5f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); - } + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.5f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); } if (death) @@ -943,7 +929,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase2) { int spore = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, npc.whoAmI); - float sporeSpeed = death ? 9f : 6f; + float sporeSpeed = death ? 8f : 6f; Vector2 sporeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * sporeSpeed; Main.npc[spore].velocity.X = sporeVelocity.X; Main.npc[spore].velocity.Y = sporeVelocity.Y; @@ -1003,7 +989,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 0f; // Timer dictating whether to pick a new location or not - float moveBoost = death ? 6f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + float moveBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.localAI[0] -= 1f + moveBoost; if (enrage) npc.localAI[0] -= 6f; @@ -1072,7 +1058,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] > 0f && npc.ai[1] > 0f) { // Hook movement velocity - float velocityBoost = death ? 9f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + float velocityBoost = death ? 6f * (1f - lifeRatio) : 3f * (1f - lifeRatio); float velocity = 7f + velocityBoost; if (enrage) velocity *= 2f; @@ -1193,7 +1179,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Velocity and acceleration - float tentacleAcceleration = death ? 2.4f : 1.6f; + float tentacleAcceleration = 1.6f; float extendedDistanceFromPlantera = Math.Abs(npc.ai[0] + npc.ai[1]) / maxOffset; float tentacleDistance = MathHelper.Lerp(50f, 100f + (extendedDistanceFromPlantera * 300f), npc.localAI[0] / extendTime); float deceleration = (death ? 0.5f : 0.8f) / (1f + extendedDistanceFromPlantera); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index b695a3093d..52a77a6819 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -18,10 +18,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Vanilla values public static int StingerDamage = 11; // 44; Also applies to GFB stinger replacements - // Death exclusive - public static int BeenadeDamage = 15; // 90 - public static int BeenadeBeeDamage = 12; // 72 - public static bool BuffedQueenBeeAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -84,7 +80,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Hornet spawn limit - int hornetLimit = 3; + int hornetLimit = 2; bool hornetLimitReached = false; // Only run this when necessary @@ -116,7 +112,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Become more aggressive and start firing double stingers (triple in death mode) phase bool phase2 = lifeRatio < 0.85f; - // Begin launching beehives instead of bees phase + // Stingers have slightly higher velocity bool phase3 = lifeRatio < 0.7f; // Stop spawning bees from ass and start performing stinger arcs + diagonal dashes, spawn bees while charging and become more aggressive phase @@ -203,21 +199,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; - int maxRandom = phase4 ? (death ? 6 : 5) : 4; + int maxRandom = phase4 ? (death ? 5 : 4) : 4; do phase = Main.rand.Next(maxRandom); while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3)); bool charging = phase == 0; bool stingerArcs = phase == 4; - bool beenadeVomit = phase == 5; // 5 is stinger arc and charge if (stingerArcs) phase = 5; - // 6 is beenade vomit - if (beenadeVomit) - phase = 6; CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); npc.ai[0] = phase; @@ -281,7 +273,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeDistanceY += 50f * enrageScale; if (death) { - chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); + chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - (lifeRatio / 2)); chargeDistanceY *= 2f; } @@ -325,8 +317,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - chargeVelocityX += 2f; - chargeVelocityY += 4f; + chargeVelocityX += 1f; + chargeVelocityY += 2f; chargeAccelerationX += 0.1f; chargeAccelerationY += 0.2f; } @@ -406,8 +398,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.X = velocity * npc.direction; float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; - if (death) - accelerateGateValue *= 0.75f; if (enrageScale > 0f) accelerateGateValue *= 0.75f; @@ -421,7 +411,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Spawn bees - float beeSpawnGateValue = death ? 16f : 20f; + float beeSpawnGateValue = 20f; bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % beeSpawnGateValue == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (spawnBee) { @@ -538,11 +528,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Get target location - float beeAttackAccel = death ? 0.6f : 0.24f; + float beeAttackAccel = death ? 0.48f : 0.24f; float beeAttackSpeed = 12f + enrageScale * 3f; if (death) - beeAttackSpeed *= 1.5f; + beeAttackSpeed *= 1.35f; bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); float distanceAboveTarget = !canHitTarget ? 0f : 320f; @@ -574,10 +564,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get target location and spawn bees from ass float beeAttackHoverSpeed = 16f + enrageScale * 4f; - float beeAttackHoverAccel = death ? 0.8f : 0.3f; + float beeAttackHoverAccel = death ? 0.6f : 0.3f; if (death) - beeAttackHoverSpeed *= 1.5f; + beeAttackHoverSpeed *= 1.35f; Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); @@ -598,7 +588,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; bool spawnBee = false; - float beeSpawnCheck = (phase3 ? 45f : 15f) - (phase3 ? 18f : 6f) * enrageScale; + float beeSpawnCheck = 9 * enrageScale; if (npc.ai[1] > beeSpawnCheck) { npc.ai[1] = 0f; @@ -613,63 +603,58 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase3) + + int spawnType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); + if (Main.zenithWorld) { - Projectile.NewProjectile(npc.GetSource_FromAI(), beeSpawnLocation, (Main.player[npc.target].Center - beeSpawnLocation).SafeNormalize(Vector2.UnitY), ProjectileID.BeeHive, 0, 0f, Main.myPlayer, 0f, 0f, 1f); + if (phase3) + spawnType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + else + spawnType = NPCID.Hellbat; } - else + else if (death) { - int spawnType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - if (Main.zenithWorld) + int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); + switch (random) { - if (phase3) - spawnType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); - else - spawnType = NPCID.Hellbat; + default: + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + + case 6: + case 7: + case 8: + spawnType = NPCID.LittleHornetHoney; + break; + + case 9: + case 10: + spawnType = NPCID.HornetHoney; + break; + + case 11: + spawnType = NPCID.BigHornetHoney; + break; } - else if (death) - { - int random = hornetLimitReached ? 0 : beeLimitReached ? Main.rand.Next(6, 12) : Main.rand.Next(12); - switch (random) - { - default: - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - - case 6: - case 7: - case 8: - spawnType = NPCID.LittleHornetHoney; - break; - - case 9: - case 10: - spawnType = NPCID.HornetHoney; - break; - - case 11: - spawnType = NPCID.BigHornetHoney; - break; - } - } - - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); - Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Main.npc[spawn].velocity = beeVelocity; - Main.npc[spawn].velocity *= 5f; - if (!Main.zenithWorld) - { - Main.npc[spawn].ai[2] = enrageScale; - Main.npc[spawn].ai[3] = 1f; - } - Main.npc[spawn].timeLeft = 600; - Main.npc[spawn].netUpdate = true; } + + int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); + Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); + Main.npc[spawn].velocity = beeVelocity; + Main.npc[spawn].velocity *= 5f; + if (!Main.zenithWorld) + { + Main.npc[spawn].ai[2] = enrageScale; + Main.npc[spawn].ai[3] = 1f; + } + Main.npc[spawn].timeLeft = 600; + Main.npc[spawn].netUpdate = true; + } } @@ -685,7 +670,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.spriteDirection = npc.direction; // Go to a random phase - float numSpawns = phase3 ? (death ? 1f : 2f) : (death ? 3f : 5f); + float numSpawns = death ? 3f : 5f; if (npc.ai[2] > numSpawns || (beeLimitReached && hornetLimitReached)) { npc.ai[0] = -1f; @@ -714,8 +699,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - stingerAttackSpeed *= 1.1f; - stingerAttackAccel *= 1.2f; + stingerAttackSpeed *= 1.08f; + stingerAttackAccel *= 1.18f; } Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); @@ -845,7 +830,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float xLocationScale = MathHelper.Lerp(-maxDistance, maxDistance, npc.ai[1] / phaseLimit) * npc.ai[2]; Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * (death ? 1.5f : 1.25f) - Vector2.UnitY * maxDistance; + Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * (death ? 1.35f : 1.25f) - Vector2.UnitY * maxDistance; Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; // Fire stingers @@ -904,7 +889,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.velocity *= 0.8f; - float idleTime = death ? 120f : 180f; + float idleTime = death ? 140f : 180f; if (npc.ai[1] >= phaseLimit + idleTime) { npc.ai[0] = -1f; @@ -917,45 +902,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } - // Spit beenades - else if (npc.ai[0] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Direction - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float beenadeAttackSpeed = 16f + 4f * enrageScale; - float beenadeAttackAccel = 0.5f; - Vector2 targetVector = Main.player[npc.target].Center - Vector2.UnitY * 240f; - - if (npc.Distance(targetVector) > 160f) - npc.SimpleFlyMovement(npc.SafeDirectionTo(targetVector) * beenadeAttackSpeed, beenadeAttackAccel); - else - npc.velocity *= 0.8f; - - float phaseLimit = 180f; - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseLimit) - { - npc.ai[0] = -1f; - npc.ai[1] = 5f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] % 61f == 0f) - { - Vector2 beenadeSpawnLocation = npc.Center + new Vector2(20f * npc.direction, -40f); - SoundEngine.PlaySound(SoundID.Item76, beenadeSpawnLocation); - int type = ModContent.ProjectileType(); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), beenadeSpawnLocation, Vector2.UnitX * 6f * npc.direction, type, BeenadeDamage, 0f, Main.myPlayer); - } - } - if (Main.dedServ) npc.ForceNetUpdate(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 2949c7af76..8a63745597 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -565,7 +565,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase5) { numProj = 15; - destination *= 0.75f; + destination *= 0.65f; for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -731,8 +731,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; - if (phase5) - numGelProjectiles += 6; if (Main.getGoodWorld) numGelProjectiles = 15; @@ -926,8 +924,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.noTileCollide = true; npc.noGravity = true; - float flyVelocity = death ? 21f : 16f; - float flyAcceleration = death ? 0.18f : 0.12f; + float flyVelocity = death ? 19f : 16f; + float flyAcceleration = death ? 0.15f : 0.12f; float flyDistanceY = death ? 350f : 450f; Vector2 desiredVelocity = npc.Center; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 4d20d1977f..bf984fce54 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -22,9 +22,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static float SpinDamageMult = 1.3f; // 91 public static int SkullDamage = 17; // 68; Also applies to crossbones - // Rev+ exclusive - public static int ShadowflameDamage = 20; // 80 - public static bool BuffedSkeletronAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -39,8 +36,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase3LifeRatio = death ? 0.9f : 0.7f; float respawnHandsLifeRatio = 0.5f; float phase4LifeRatio = death ? 0.4f : 0.3f; - float useSkullSpreadsAfterChargeLifeRatio = death ? 0.3f : 0.2f; - float phase5LifeRatio = death ? 0.2f : 0.1f; + float phase5LifeRatio = death ? 0.15f : 0.1f; // Begin firing spreads of skulls phase bool phase2 = lifeRatio < phase2LifeRatio; @@ -54,9 +50,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fire giant cursed skull projectiles (yes, these curse you if you get hit) during charge attack and hands fire skulls phase bool phase4 = lifeRatio < phase4LifeRatio; - // Self-explanatory - bool useSkullSpreadsAfterCharge = lifeRatio < useSkullSpreadsAfterChargeLifeRatio; - // Rapid teleport and charge, stop using idle phase bool phase5 = lifeRatio < phase5LifeRatio; @@ -209,7 +202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (death) - headSpinVelocityMult *= 1.2f; + headSpinVelocityMult *= 1.08f; // Very volatile value // Velocity used to move Skeletron away from the target before charging float moveAwayVelocity = headSpinVelocityMult; @@ -351,9 +344,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Skull shooting - if ((handsDead || death) && npc.ai[1] == 0f && !phase4) + if ((handsDead) && npc.ai[1] == 0f && !phase4) { - float skullProjFrequency = phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; + float skullProjFrequency = phase2 ? (48f - (death ? 10f * (1f - lifeRatio) : 0f)) : 60f; if (Main.getGoodWorld) skullProjFrequency *= 0.8f; skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); @@ -365,7 +358,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float skullProjTargetY = Main.player[npc.target].Center.Y - skullFiringPos.Y; if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; + float skullProjSpeed = phase2 ? (5f + (death ? 1f * (1f - lifeRatio) : 0f)) : 4f; int spread2 = 50; Vector2 skullProjDirection = new Vector2(skullProjTargetX + Main.rand.Next(-spread2, spread2 + 1) * 0.01f, skullProjTargetY + Main.rand.Next(-spread2, spread2 + 1) * 0.01f).SafeNormalize(Vector2.UnitY); skullProjDirection *= skullProjSpeed; @@ -404,7 +397,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] > chargePhaseGateValue) npc.localAI[1] = chargePhaseGateValue; - float forcedMoveAwayTime = death ? 15f : 45f; + float forcedMoveAwayTime = death ? 30f : 45f; float canChargeDistance = 320f; // 20 tile distance bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; @@ -582,28 +575,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (calamityGlobalNPC.newAI[1] == 2f) SoundEngine.PlaySound(phase3 ? SoundID.ForceRoarPitched : SoundID.ForceRoar, npc.Center); - // Shoot shadowflames (giant cursed skull projectiles) while charging in phase 4 - if (phase4 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float shadowFlameGateValue = 20f; - int shadowFlameLimit = death ? 3 : 2; - if (calamityGlobalNPC.newAI[1] % shadowFlameGateValue == 0f && calamityGlobalNPC.newAI[1] < shadowFlameGateValue * shadowFlameLimit) - { - // Spawn projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 240f) - { - float shadowFlameProjectileSpeed = death ? 6f : 4f; - Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; - int type = ProjectileID.Shadowflames; - int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, ShadowflameDamage, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[shadowFlameProjectile].timeLeft = 600; - } - } - } - } - // Reset telegraph timer to create color fade if (npc.localAI[1] > 0f) { @@ -644,31 +615,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (useSkullSpreadsAfterCharge && !disableSkullsAfterCharge && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - // Spawn projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int chargeSkullAmt = death ? 5 : 3; - int chargeSkullSpread = death ? 80 : 60; - float rotation = MathHelper.ToRadians(chargeSkullSpread); - float skullProjSpeed = phase5 ? (6f + (death ? 2f * ((phase5LifeRatio - lifeRatio) / phase5LifeRatio) : 0f)) : 4f; - Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; - int type = ProjectileID.Skull; - for (int k = 0; k < chargeSkullAmt + 1; k++) - { - Vector2 perturbedSpeed = initialProjectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, k / (float)(chargeSkullAmt - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, SkullDamage, 0f, Main.myPlayer, -1f); - Main.projectile[proj].timeLeft = 600; - if (death) - { - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, SkullDamage, 0f, Main.myPlayer, -2f); - Main.projectile[proj2].timeLeft = 600; - } - } - } - } - npc.ai[2] = 0f; npc.ai[1] = 0f; npc.localAI[0] = 0f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index fc48a09a9c..1954a9222d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.X / 15f; - float acceleration = death ? (0.12f + 0.05f * (1f - lifeRatio)) : 0.1f; + float acceleration = death ? (0.125f + 0.05f * (1f - lifeRatio)) : 0.1f; float accelerationMult = 1f; if (!cannonAlive) { @@ -675,7 +675,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool normalLaserRotation = npc.localAI[1] % 2f == 0f; // Movement - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -969,7 +969,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Movement - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!laserAlive) { @@ -1171,7 +1171,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Return to the head if (npc.ai[2] == 99f) { - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1261,7 +1261,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1518,7 +1518,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 99f) { - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1604,7 +1604,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = death ? 0.375f : 0.25f; + float acceleration = death ? 0.385f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 9d8b889e78..63dc7c9b45 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -144,8 +144,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; } if (Main.getGoodWorld) @@ -229,7 +229,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float chargeSpeed = death ? 18f : 15f; if (death) - chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; if (Main.getGoodWorld) chargeSpeed += 2f; @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 1.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (npc.ai[2] >= delayBeforeChargingAgain) { npc.ai[3] += 1f; @@ -390,8 +390,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) { - float maxVelocity = death ? 10.85f + 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; - float acceleration = death ? 0.1975f + 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.175f; + float maxVelocity = death ? 10.85f + 1.75f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; + float acceleration = death ? 0.1975f + 0.025f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.175f; if (Main.getGoodWorld) { @@ -422,7 +422,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); npc.ai[2] += spazAlive ? 1f : 1.5f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 120f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float phaseGateValue = NPC.IsMechQueenUp ? 900f : 300f - (death ? 80f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] >= phaseGateValue) { npc.ai[1] = 1f; @@ -440,7 +440,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); + npc.localAI[1] += 1f + (death ? ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) / 2 : 0f); if (npc.localAI[1] >= (spazAlive ? 52f : 26f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -460,7 +460,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.ai[1] == 1f) { - float maxVelocity = death ? 10.85f + 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; + float maxVelocity = death ? 10.85f + 1.75f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; float acceleration = death ? 0.295f + 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.25f; if (Main.getGoodWorld) @@ -479,7 +479,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); + npc.localAI[1] += 1f + (death ? ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) / 2 : 0f); if (npc.localAI[1] > (spazAlive ? 20f : 10f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -497,7 +497,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[2] += spazAlive ? 1f : 1.5f; - if (npc.ai[2] >= (death ? 150f : 180f) - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + if (npc.ai[2] >= (death ? 150f : 180f) - (death ? 25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { npc.ai[1] = finalPhase ? 4f : 0f; npc.ai[2] = 0f; @@ -517,7 +517,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set rotation and velocity npc.rotation = hoverRotation; - float chargeSpeed = (death ? 25f : 22f) + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = (death ? 25f : 22f) + (death ? 3.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (!spazAlive) chargeSpeed += 2f; if (Main.getGoodWorld) @@ -536,7 +536,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[3] % 3f == 0f) chargeTime = spazAlive ? 90f : 60f; if (death) - chargeTime -= chargeTime * 0.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio); + chargeTime -= chargeTime * 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio); chargeTime -= chargeTime * (death ? 0.06f : 0f); // Slow down @@ -561,7 +561,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float laserDartSpeed = (death ? 9f : 6f) * (spazAlive ? 1f : 1.5f); + float laserDartSpeed = (death ? 7.5f : 6f) * (spazAlive ? 1f : 1.5f); int type = ModContent.ProjectileType(); int damage = HomingDartDamage.CalculateMechDamage(); @@ -621,8 +621,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 4f) { float chargeLineUpDistance = spazAlive ? 600f : 500f; - float chargeSpeed = (death ? 19.8f : 18f) + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAcceleration = (death ? 0.495f : 0.45f) + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = (death ? 19.8f : 18f) + (death ? 2.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = (death ? 0.495f : 0.45f) + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (spazAlive) { @@ -642,7 +642,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Take 1.25 or 1 second to get in position, then charge npc.ai[2] += 1f; - if (npc.ai[2] >= (spazAlive ? 75f : 60f) - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) + if (npc.ai[2] >= (spazAlive ? 75f : 60f) - (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { npc.ai[1] = 2f; npc.ai[2] = 0f; @@ -769,8 +769,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) / 2; } if (Main.getGoodWorld) @@ -856,7 +856,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] += 1f; - float timeBeforeSlowDown = death ? 30f : 10f; + float timeBeforeSlowDown = death ? 18f : 10f; if (npc.ai[2] >= timeBeforeSlowDown) { // Slow down @@ -871,7 +871,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charge 8 times - float chargeTime = death ? 45f : 25f; + float chargeTime = death ? 35f : 25f; if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase @@ -1015,8 +1015,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shadowflamethrower phase if (npc.ai[1] == 0f) { - float maxVelocity = (death ? 7.1f : 6.2f) + (death ? 2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = (death ? 0.118f : 0.1f) + (death ? 0.03f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float maxVelocity = 7.1f + (death ? 0.8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = 0.118f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); float distanceFromTarget = 180f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; @@ -1027,7 +1027,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Boost speed if too far from target if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + maxVelocity += MathHelper.Lerp(0f, 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1040,7 +1040,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fire flamethrower for x seconds npc.ai[2] += retAlive ? 1f : 2f; - float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 30f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] >= phaseGateValue) { npc.ai[1] = finalPhase ? 5f : 1f; @@ -1117,7 +1117,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set rotation and velocity npc.rotation = hoverRotation; - float chargeSpeed = (death ? 22.8f : 18f) + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = (death ? 22.8f : 18f) + (death ? 1.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -1132,7 +1132,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] += retAlive ? 1f : 1.25f; - float chargeTime = 30f - (death ? 10f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeTime = 30f - (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); // Slow down if (npc.ai[2] >= chargeTime) @@ -1189,7 +1189,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (Main.netMode != NetmodeID.MultiplayerClient) { // Velocity - float spazmatismPhase3ChargeSpeed = (death ? 23f : 20f) + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float spazmatismPhase3ChargeSpeed = (death ? 23f : 20f) + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) spazmatismPhase3ChargeSpeed *= 1.3f; if (Main.getGoodWorld) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index e1fe967125..b5e374ff31 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -20,9 +20,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static int LaserDamage = 15; // 60 (modified to be always at maximum Expert damage and does not scale) public static int SickleDamage = 22; // 88 - // Death exclusive - public static int FireballDamage = 18; // 108 - public static bool BuffedWallofFleshAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -88,7 +85,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 0f) { if (death) - npc.ai[1] += 2f; + npc.ai[1] += 1f; if (phase2) npc.ai[1] += 1f; @@ -129,26 +126,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, SickleDamage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].tileCollide = false; - - if (death) - { - float fireballVelocity = npc.velocity.Length() + 3f; - projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * fireballVelocity; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.Fireball; - int numProj = 3; - int spread = 15; - float rotation = MathHelper.ToRadians(spread); - fireballVelocity *= 0.1f; - for (int j = 0; j < numProj; j++) - { - Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(fireballVelocity, fireballVelocity); - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, FireballDamage, 0f, Main.myPlayer); - } - } - } } } } @@ -310,18 +287,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); - deathModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + deathModeVelocityBoost = MathHelper.Lerp(0f, 4f, lerpAmount); } // NOTE: Max velocity is 8 in Expert Mode // NOTE: Max velocity is 9 in For The Worthy float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (death ? 3.5f : 2f) + deathModeVelocityBoost + velocityBoost; + float velocityX = 2f + deathModeVelocityBoost + velocityBoost; velocityX *= speedMult; if (death) - velocityX *= 1.2f; + velocityX *= 1.1f; if (Main.getGoodWorld) { @@ -443,7 +420,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(chance)) { - int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(death ? 2f : 1f, death ? 8f : 4f, npc.life / (float)npc.lifeMax)); + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(death ? 2f : 1f, death ? 6f : 4f, npc.life / (float)npc.lifeMax)); if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { int hungryAmt = 0; @@ -519,7 +496,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - int maxHungries = death ? 16 : 11; + int maxHungries = death ? 14 : 11; float maxOffset = death ? (0.2f / 3f) : 0.1f; for (int j = 0; j < maxHungries; j++) { @@ -647,7 +624,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (wallLifeRatio < 0.1f) velocityBoost += 0.9f; - velocityBoost *= death ? 1.5f : 1.25f; + velocityBoost *= death ? 1.4f : 1.25f; velocityBoost += 0.3f; maxVelocity += velocityBoost * 0.35f; if (npc.Center.X < Main.npc[Main.wofNPCIndex].Center.X && Main.npc[Main.wofNPCIndex].velocity.X > 0f) @@ -721,7 +698,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity, direction, and position bool shouldFireLasers = true; - float phase2LifeRatio = 0.5f; + float phase2LifeRatio = 0.4f; bool deathModeDetach = lifeRatio < phase2LifeRatio && death; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (!deathModeDetach) diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index f9db3ad02d..f9722a2b14 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -2411,7 +2411,7 @@ PrepareToShoot: Projectile.NewProjectile(npc.GetSource_FromAI(), mouth, velocity, ProjectileID.WebSpit, 18, 0f, Main.myPlayer); } } - else + else if (npcType == NPCID.BlackRecluse || npcType == NPCID.BlackRecluseWall || npc.type == NPCID.JungleCreeper || npc.type == NPCID.JungleCreeperWall || prehardmodeSpiders) npc.localAI[0] = 0f; if (npcType == NPCID.IceGolem) @@ -4318,25 +4318,9 @@ PrepareToShoot: bool wormHead = npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.LeechHead || npc.type == NPCID.DuneSplicerHead || (!Main.player[npc.target].ZoneUndergroundDesert && npc.type == NPCID.TombCrawlerHead); float acceleration = npc.type == NPCID.TombCrawlerHead ? 0.1f : 0.2f; - bool isSplittingNPC = (npc.type >= NPCID.DiggerHead && npc.type <= NPCID.DiggerTail) || (npc.type >= NPCID.SeekerHead && npc.type <= NPCID.SeekerTail) || (npc.type >= NPCID.DuneSplicerHead && npc.type <= NPCID.DuneSplicerTail); - - bool isSplittingNPCHead = npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.DuneSplicerHead; - - bool isSplittingNPCBody = npc.type == NPCID.DiggerBody || npc.type == NPCID.SeekerBody || npc.type == NPCID.DuneSplicerBody; - - bool isSplittingNPCTail = npc.type == NPCID.DiggerTail || npc.type == NPCID.SeekerTail || npc.type == NPCID.DuneSplicerTail; - - if (isSplittingNPC) - { - npc.realLife = -1; - } - else - { - npc.defense = (int)Math.Round(npc.defDefense * 1.3); - - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - } + npc.defense = (int)Math.Round(npc.defDefense * 1.3); + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || (wormHead && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0)) { @@ -4467,15 +4451,12 @@ PrepareToShoot: currentBloodEel = bloodEelSegment; } } - else if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) + else if ((npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) { - if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) + if (npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) { - if (!isSplittingNPCHead) - { - npc.ai[3] = (float)npc.whoAmI; - npc.realLife = npc.whoAmI; - } + npc.ai[3] = (float)npc.whoAmI; + npc.realLife = npc.whoAmI; switch (npc.type) { @@ -4504,7 +4485,7 @@ PrepareToShoot: npc.ai[0] = (float)NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - else if ((isSplittingNPCBody || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) + else if ((npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) { npc.ai[0] = (float)NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } @@ -4513,90 +4494,32 @@ PrepareToShoot: npc.ai[0] = (float)NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - if (!isSplittingNPC) - { - Main.npc[(int)npc.ai[0]].ai[3] = npc.ai[3]; - Main.npc[(int)npc.ai[0]].realLife = npc.realLife; - } + Main.npc[(int)npc.ai[0]].ai[3] = npc.ai[3]; + Main.npc[(int)npc.ai[0]].realLife = npc.realLife; Main.npc[(int)npc.ai[0]].ai[1] = (float)npc.whoAmI; Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; npc.netUpdate = true; } - if (!isSplittingNPC) + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) { - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle) { - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - } - if (npc.ai[0] > 0f && npc.ai[0] < (float)Main.npc.Length) - { - if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } - else + if (npc.ai[0] > 0f && npc.ai[0] < (float)Main.npc.Length) { - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle) { npc.life = 0; npc.HitEffect(0, 10.0); - npc.checkDead(); npc.active = false; NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (isSplittingNPCHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (isSplittingNPCTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (isSplittingNPCBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = npc.type - 1; - int whoAmI = npc.whoAmI; - float currentHealthAmt = (float)npc.life / (float)npc.lifeMax; - float newSegment = npc.ai[0]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * currentHealthAmt); - npc.ai[0] = newSegment; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; - } - if (isSplittingNPCBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - int whoAmI2 = npc.whoAmI; - float currentHealthAmt2 = (float)npc.life / (float)npc.lifeMax; - float newSegment = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * currentHealthAmt2); - npc.ai[1] = newSegment; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; - } } if (!npc.active && Main.dedServ) @@ -4667,7 +4590,7 @@ PrepareToShoot: } } - if (!flying && (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) + if (!flying && (npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int noFlyZone = 1000; diff --git a/Particles/ChumBone.cs b/Particles/ChumBone.cs index 88838070b4..9e7875dc0f 100644 --- a/Particles/ChumBone.cs +++ b/Particles/ChumBone.cs @@ -14,11 +14,10 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - private bool direction; - private bool variant; + private bool TexVariant; public static string Texture2 => "CalamityMod/Particles/ChumBone2"; - public ChumBone(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, int lifeTime, bool variant, bool direction) + public ChumBone(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, int lifeTime, bool variant) { Position = position; Velocity = velocity; @@ -26,6 +25,7 @@ namespace CalamityMod.Particles Lifetime = lifeTime; Rotation = rotation; Color = color; + TexVariant = variant; } public override void Update() @@ -54,8 +54,8 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { - Texture2D tex = variant ? ModContent.Request(Texture2).Value : ModContent.Request(Texture).Value; - SpriteEffects spriteDir = direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Texture2D tex = TexVariant ? ModContent.Request(Texture2).Value : ModContent.Request(Texture).Value; + SpriteEffects spriteDir = SpriteEffects.FlipHorizontally; spriteBatch.Draw(tex, Position - Main.screenPosition, null, Lighting.GetColor(Position.ToTileCoordinates()), Rotation, new Vector2(tex.Width / 2, tex.Height), Scale, spriteDir, 0); } } diff --git a/Particles/PulseStar.png b/Particles/PulseStar.png new file mode 100644 index 0000000000..4505d12981 Binary files /dev/null and b/Particles/PulseStar.png differ diff --git a/Particles/RainbowSparkParticle.cs b/Particles/RainbowSparkParticle.cs new file mode 100644 index 0000000000..5ba07c9e63 --- /dev/null +++ b/Particles/RainbowSparkParticle.cs @@ -0,0 +1,90 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class RainbowGlowSparkParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool QuickShrink; + public bool Glowing; + public float ShrinkSpeed = 1; + public Vector2 Squash = new Vector2(0.5f, 1.6f); + public float HueShift; + + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + + public override string Texture => "CalamityMod/Particles/GlowSpark"; + + public RainbowGlowSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color initialColor, Vector2 squash, bool quickShrink = false, bool glow = true, float shrinkSpeed = 1, float hueShift = 0) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = initialColor; + Squash = squash; + QuickShrink = quickShrink; + Glowing = glow; + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + ShrinkSpeed = shrinkSpeed; + HueShift = hueShift; + } + + public override void Update() + { + Scale *= 0.95f; + Velocity *= 0.95f; + if (QuickShrink) + { + if (ShrinkSpeed == 1) + { + Squash.X *= 0.8f; + Squash.Y *= 1.2f; + } + else + { + Squash.X *= (1 - 0.2f * ShrinkSpeed); + Squash.Y *= (1 + 0.2f * ShrinkSpeed); + } + } + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + + Color = Main.hslToRgb(Main.rgbToHsl(Color).X + HueShift, Main.rgbToHsl(Color).Y, Main.rgbToHsl(Color).Z); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Squash * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); + if (Glowing) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f) * scaleMult, 0, 0f); + } + } +} diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index 6e413c3fd5..ebdfb9cc2d 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -265,20 +265,17 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void ModifyDamageHitbox(ref Rectangle hitbox) { Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset); - hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y); - if (false) // Turn this on to show the hitbox, useful for testing if it's working how you want - { - Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); - GeneralParticleHandler.SpawnParticle(blastRing); - Particle blastRing2 = new CustomPulse(hitbox.TopRight(), Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); - GeneralParticleHandler.SpawnParticle(blastRing2); - Particle blastRing3 = new CustomPulse(hitbox.BottomLeft(), Vector2.Zero, Color.Green, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); - GeneralParticleHandler.SpawnParticle(blastRing3); - Particle blastRing4 = new CustomPulse(hitbox.BottomRight(), Vector2.Zero, Color.Cyan, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); - GeneralParticleHandler.SpawnParticle(blastRing4); - } + // Turn this on to show the hitbox, useful for testing if it's working how you want + /*Particle blastRing = new CustomPulse(hitbox.TopLeft(), Vector2.Zero, Color.Red, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(hitbox.TopRight(), Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(hitbox.BottomLeft(), Vector2.Zero, Color.Green, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(hitbox.BottomRight(), Vector2.Zero, Color.Cyan, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 4); + GeneralParticleHandler.SpawnParticle(blastRing4);*/ base.ModifyDamageHitbox(ref hitbox); } diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs index 7f3e4dea90..da2ebc2cde 100644 --- a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -100,6 +100,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// Defaults to . /// public bool KeepRefreshingLifetime { get; set; } = true; + /// + /// If the holdout should constantly set Owner.itemTime and Owner.itemAnimation as 2. + /// + public bool SetUsage { get; set; } = true; /// /// The current offset length from the arm of the holdout.
@@ -216,7 +220,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner.ChangeDir(direction); Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = Owner.itemAnimation = 2; + if (SetUsage) + Owner.itemTime = Owner.itemAnimation = 2; Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); // -Pi/2 because the arms rotation starts with arms pointing down. diff --git a/Projectiles/Boss/PeanutRocket.cs b/Projectiles/Boss/PeanutRocket.cs index e0e203d817..a90b447645 100644 --- a/Projectiles/Boss/PeanutRocket.cs +++ b/Projectiles/Boss/PeanutRocket.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Boss public class PeanutRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Ranged/HighExplosivePeanutShell"; public override void SetStaticDefaults() { diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.png b/Projectiles/Boss/PeanutRocket.png similarity index 100% rename from Projectiles/Ranged/HighExplosivePeanutShell.png rename to Projectiles/Boss/PeanutRocket.png diff --git a/Projectiles/Boss/QueenBeenade.cs b/Projectiles/Boss/QueenBeenade.cs deleted file mode 100644 index 952687ebf8..0000000000 --- a/Projectiles/Boss/QueenBeenade.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class QueenBeenade : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.Beenade}"; - - private const int TimeLeft = 180; - - public override void SetDefaults() - { - Projectile.Calamity().DealsDefenseDamage = true; - Projectile.width = 14; - Projectile.height = 22; - Projectile.hostile = true; - Projectile.penetrate = -1; - Projectile.timeLeft = TimeLeft; - } - - public override void AI() - { - if (Projectile.ai[0] > 5f) - { - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - - Projectile.velocity.Y += 0.2f; - } - else - Projectile.ai[0] += 1f; - - Projectile.rotation += Projectile.velocity.X * 0.1f; - - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; - } - - // Using 1 just in case - public override bool? CanDamage() => Projectile.timeLeft <= 1; - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = oldVelocity.X * -0.5f; - - if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) - Projectile.velocity.Y = oldVelocity.Y * -0.5f; - - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - int timer = TimeLeft - Projectile.timeLeft; - float startWarningColorGateValue = 60f; - float timeToReachFullIntensity = 120f; - float timeToReachExplosion = startWarningColorGateValue + timeToReachFullIntensity; - Color initialColor = lightColor; - Color finalColor = Color.Lerp(new Color(125, 0, 0), Color.Red, (float)Math.Abs(Math.Sin((timer - startWarningColorGateValue) * (MathHelper.Pi / 45f)))); - finalColor.A = (byte)(255 - Projectile.alpha); - if (timer > startWarningColorGateValue) - { - float colorTransitionRatio = (timer - startWarningColorGateValue) / timeToReachFullIntensity; - Color explodeColor = Color.Lerp(initialColor, finalColor, colorTransitionRatio); - return explodeColor; - } - else - return initialColor; - } - - public override void OnKill(int timeLeft) - { - int newSize = 40; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = newSize; - Projectile.Center = Projectile.position; - Projectile.Damage(); - - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - - for (int i = 0; i < 20; i++) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - - if (!Main.dedServ) - { - int gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y += 1f; - Main.gore[gore].velocity *= 0.3f; - gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y += 1f; - Main.gore[gore].velocity *= 0.3f; - gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y -= 1f; - Main.gore[gore].velocity *= 0.3f; - gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y -= 1f; - Main.gore[gore].velocity *= 0.3f; - } - - if (Projectile.owner == Main.myPlayer) - { - int beeAmount = Main.rand.Next(5, 8); - int type = ModContent.ProjectileType(); - float minVelocity = 8f; - float maxVelocity = 16f; - for (int i = 0; i < beeAmount; i++) - { - float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; - float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, new Vector2(speedX, speedY), type, QueenBeeAI.BeenadeBeeDamage, 0f, Main.myPlayer, 0f, minVelocity, maxVelocity); - } - } - } - } -} diff --git a/Projectiles/Boss/QueenBeenadeBee.cs b/Projectiles/Boss/QueenBeenadeBee.cs deleted file mode 100644 index 905267966e..0000000000 --- a/Projectiles/Boss/QueenBeenadeBee.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class QueenBeenadeBee : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.GiantBee}"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.hostile = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 420; - } - - public override void AI() - { - // Animation - Projectile.frameCounter++; - if (Projectile.frameCounter >= 3) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= 3) - Projectile.frame = 0; - - // Direction and rotation - Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1; - Projectile.rotation = Projectile.velocity.X * 0.1f; - - // Difficulty modes - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // Get a target and calculate distance from it - int target = Player.FindClosest(Projectile.Center, 1, 1); - Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; - - // Set AI to stop homing, start accelerating - float stopHomingDistance = 120f; - if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 120) - { - Projectile.ai[0] = 1f; - - Projectile.tileCollide = true; - - if (Projectile.velocity.Length() < Projectile.ai[2]) - Projectile.velocity *= 1.05f; - - return; - } - - // Fly off for a bit before homing - if (Projectile.timeLeft > 300) - { - if (Projectile.velocity.Length() < Projectile.ai[1]) - Projectile.velocity *= 1.05f; - - return; - } - - // Home in on target - float scaleFactor = Projectile.velocity.Length(); - float inertia = 16f; - distanceFromTarget.Normalize(); - distanceFromTarget *= scaleFactor; - Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); - Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor; - - // Fly away from other bees - float pushForce = 0.05f; - float pushDistance = 60f; - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == Projectile.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherProj.type == Projectile.type; - float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); - if (sameProjType && taxicabDist < pushDistance) - { - if (Projectile.position.X < otherProj.position.X) - Projectile.velocity.X -= pushForce; - else - Projectile.velocity.X += pushForce; - - if (Projectile.position.Y < otherProj.position.Y) - Projectile.velocity.Y -= pushForce; - else - Projectile.velocity.Y += pushForce; - } - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.Poisoned, 120); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); - return false; - } - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 6; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 150, Projectile.velocity.X, Projectile.velocity.Y, 50); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1f; - } - } - } -} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1880f10b17..f72448ad02 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -448,7 +448,7 @@ namespace CalamityMod.Projectiles if (Main.rand.NextBool(24)) SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, projectile.Center); - Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height) * 0.42f, 267); + Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height) * 0.42f, DustID.RainbowMk2); fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.45f, 1f)); fire.scale = Main.rand.NextFloat(1.4f, 1.65f); fire.fadeIn = 0.5f; @@ -1444,7 +1444,7 @@ namespace CalamityMod.Projectiles { float x2 = projectile.position.X - projectile.velocity.X / (float)totalDust * (float)i; float y2 = projectile.position.Y - projectile.velocity.Y / (float)totalDust * (float)i; - int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, 75); + int dust = Dust.NewDust(new Vector2(x2, y2), 1, 1, DustID.CursedTorch); Main.dust[dust].alpha = projectile.alpha; Main.dust[dust].position.X = x2; Main.dust[dust].position.Y = y2; @@ -2061,14 +2061,14 @@ namespace CalamityMod.Projectiles projectile.rotation = projectile.velocity.ToRotation(); for (int dustIndex = 0; dustIndex < 5; dustIndex++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(24f, 24f), 16, projectile.velocity * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat())); + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(24f, 24f), DustID.Cloud, projectile.velocity * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat())); dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f); dust.scale = 0.8f + Main.rand.NextFloat() * 0.5f; } for (int dustIndex = 0; dustIndex < 5; dustIndex++) { - Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(24f, 24f), 16, Main.rand.NextVector2Circular(2f, 2f) + projectile.velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat())); + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(24f, 24f), DustID.Cloud, Main.rand.NextVector2Circular(2f, 2f) + projectile.velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat())); dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f); dust.scale = 0.8f + Main.rand.NextFloat() * 0.5f; dust.fadeIn = 1f; @@ -4254,7 +4254,7 @@ namespace CalamityMod.Projectiles for (int i = 0; i < 2; ++i) { - Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, 261, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); + Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, DustID.AncientLight, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.65f, 0.9f); dust.alpha = 100; @@ -4277,7 +4277,7 @@ namespace CalamityMod.Projectiles for (int i = 0; i < 3; ++i) { - Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, 278, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.35f, 0.45f); dust.color = color; @@ -4306,7 +4306,7 @@ namespace CalamityMod.Projectiles for (int i = 0; i < 3; ++i) { - Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, 278, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); + Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.35f, 0.45f); dust.color = color; @@ -4645,7 +4645,12 @@ namespace CalamityMod.Projectiles target.Calamity().hyperiusMarked = false; } } - + // Crystal Darts reset iframes on bouncing off an enemy + if (projectile.type == ProjectileID.CrystalDart) + { + projectile.ResetLocalNPCHitImmunity(); + projectile.localNPCImmunity[target.whoAmI] = -1; + } // Implementation of shared static iframes. // If this projectile does not use static iframes, or is not registered to share them, then do nothing. if (!projectile.usesIDStaticNPCImmunity || CalamityProjectileSets.SharedIDStaticIFrames[projectile.type] == -1) @@ -4745,6 +4750,18 @@ namespace CalamityMod.Projectiles } #endregion + #region TileCollide + public override bool OnTileCollide(Projectile projectile, Vector2 oldVelocity) + { + //Crystal Darts use -1 local that needs to reset whenever they bounce + if (projectile.type == ProjectileID.CrystalDart) + { + projectile.ResetLocalNPCHitImmunity(); + } + return base.OnTileCollide(projectile, oldVelocity); + } + #endregion + #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { @@ -4875,7 +4892,7 @@ namespace CalamityMod.Projectiles if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(TextureAssets.Extra[98].Value, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY) - projectile.velocity * projectile.scale * 0.5f, null, projectile.GetAlpha(new Color(vector41.X, vector41.Y, vector41.Z, vector41.W)), projectile.rotation + MathHelper.PiOver2, TextureAssets.Extra[98].Value.Size() / 2f, projectile.scale * 0.9f, spriteEffects); + Main.EntitySpriteDraw(TextureAssets.Extra[ExtrasID.SharpTears].Value, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY) - projectile.velocity * projectile.scale * 0.5f, null, projectile.GetAlpha(new Color(vector41.X, vector41.Y, vector41.Z, vector41.W)), projectile.rotation + MathHelper.PiOver2, TextureAssets.Extra[ExtrasID.SharpTears].Value.Size() / 2f, projectile.scale * 0.9f, spriteEffects); Color color49 = projectile.GetAlpha(Color.White) * Utils.Remap(projectile.ai[0], 0f, killGateValue, 0.5f, 0f); color49.A = 0; diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index cf8e477701..590d769244 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -328,7 +328,7 @@ namespace CalamityMod.Projectiles { ProjectileID.CrimsandBallGun, defaultIFrames }, { ProjectileID.CrimsonHeart, defaultIFrames }, { ProjectileID.CrimsonSpray, defaultIFrames }, - { ProjectileID.CrystalDart, defaultIFrames }, + { ProjectileID.CrystalDart, Do( ExtraUpdatesExact(2), LocalIFrames(-1)) }, { ProjectileID.CrystalLeaf, defaultIFrames }, { ProjectileID.CrystalLeafShot, defaultIFrames }, { ProjectileID.CrystalPulse, defaultIFrames }, @@ -338,7 +338,7 @@ namespace CalamityMod.Projectiles { ProjectileID.CrystalVileShardHead, defaultIFrames }, { ProjectileID.CrystalVileShardShaft, defaultIFrames }, { ProjectileID.CursedArrow, defaultIFrames }, - { ProjectileID.CursedDart, defaultIFrames }, + { ProjectileID.CursedDart, Do( ExtraUpdatesExact(1), LocalIFrames(20)) }, { ProjectileID.CursedDartFlame, defaultIFrames }, { ProjectileID.CursedFlameFriendly, defaultIFrames }, { ProjectileID.CursedFlare, defaultIFrames }, @@ -397,7 +397,7 @@ namespace CalamityMod.Projectiles { ProjectileID.IceBlock, defaultIFrames }, { ProjectileID.IceBolt, defaultIFrames }, { ProjectileID.IchorArrow, defaultIFrames }, - { ProjectileID.IchorDart, defaultIFrames }, + { ProjectileID.IchorDart, Do( ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.JackOLantern, defaultIFrames }, { ProjectileID.JavelinFriendly, defaultIFrames }, { ProjectileID.JestersArrow, defaultIFrames }, @@ -466,7 +466,7 @@ namespace CalamityMod.Projectiles { ProjectileID.PhantasmArrow, defaultIFrames }, { ProjectileID.PineNeedleFriendly, defaultIFrames }, { ProjectileID.PlatinumCoin, defaultIFrames }, - { ProjectileID.PoisonDart, defaultIFrames }, + { ProjectileID.PoisonDart, Do( ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.PoisonDartBlowgun, defaultIFrames }, { ProjectileID.PoisonDartTrap, defaultIFrames }, { ProjectileID.PoisonedKnife, defaultIFrames }, diff --git a/Projectiles/Damageable/DamageableProjectile.cs b/Projectiles/Damageable/DamageableProjectile.cs index 123e64c7a8..78b8dfc344 100644 --- a/Projectiles/Damageable/DamageableProjectile.cs +++ b/Projectiles/Damageable/DamageableProjectile.cs @@ -151,17 +151,11 @@ namespace CalamityMod.Projectiles.Damageable } if (wasHit && Life > 0) { - if (HitSound != null) - { - SoundEngine.PlaySound(HitSound, Projectile.Center); - } + SoundEngine.PlaySound(HitSound, Projectile.Center); } else if (Life <= 0) { - if (DeathSound != null) - { - SoundEngine.PlaySound(DeathSound, Projectile.Center); - } + SoundEngine.PlaySound(DeathSound, Projectile.Center); DamageKillEffect(); Projectile.Kill(); } diff --git a/Projectiles/DraedonsArsenal/NidhoggHoldout.cs b/Projectiles/DraedonsArsenal/NidhoggHoldout.cs index a8b14bd9f5..916229dc40 100644 --- a/Projectiles/DraedonsArsenal/NidhoggHoldout.cs +++ b/Projectiles/DraedonsArsenal/NidhoggHoldout.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override int AssociatedItemID => ModContent.ItemType(); - public Player Owner => Main.player[Projectile.owner]; public float offsetBase = 30; public override float MaxOffsetLengthFromArm => offsetBase; public override float RecoilResolveSpeed => (shootingTimer < 0) ? 0.02f : 0.1f; diff --git a/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs b/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs index 9903b3f728..29031dc634 100644 --- a/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs +++ b/Projectiles/DraedonsArsenal/PhalanxSurgeHoldout.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override int AssociatedItemID => ModContent.ItemType(); - public Player Owner => Main.player[Projectile.owner]; public float offsetBase = 30; public override float MaxOffsetLengthFromArm => doingChargeAttack ? 100f : offsetBase; public override float RecoilResolveSpeed => doingChargeAttack ? 2f : (shootingTimer < 0) ? 0.2f : 0.1f; diff --git a/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs b/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs index 5c1d41f657..a2537d86b8 100644 --- a/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs +++ b/Projectiles/DraedonsArsenal/PhalanxSurgeLaser.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public new string LocalizationCategory => "Projectiles.Misc"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private int dust = 127; public int time = 0; public override void SetDefaults() { diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index f864cef1ff..3e1d9adcde 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -26,14 +26,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/Phaseslayer"; // The "average" or "expected" swing speed which the sword's damage balance is based off of. - // This is rotation EVERY FRAME. The "average" swing speed is 360 degrees in one second, aka pi/30 radians per frame. - public const float StandardSwingSpeed = MathHelper.Pi / 30f; + // This is rotation EVERY FRAME. The "average" swing speed is 180 degrees in one second, aka pi/60 radians per frame. + public const float StandardSwingSpeed = MathHelper.Pi / 60f; // How quickly the sword's damage updates to reflect its current speed. Higher values make it change damage more quickly. public const float DamageUpdateResponsiveness = 0.08f; public const int SwordBeamCooldown = 15; - public const float SwordBeamDamageMultiplier = 0.15f; + public const float SwordBeamDamageMultiplier = 0.2f; private const float MaximumMouseRange = 360f; private const float ProjCenterOffset = 36f; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 13; + Projectile.localNPCHitCooldown = 10; } // Vanilla Terraria doesn't sync projectile rotation, but it does sync velocity. @@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This formula ensures that the sword has a sudden and extremely harsh responsiveness penalty when the mouse is close to the player. // Otherwise it controls perfectly fine. - float aimResponsiveness = 0.035f + 0.3f * (float)Math.Pow(distRatio, 1D/3); + float aimResponsiveness = 0.035f + 0.3f * MathF.Pow(distRatio, 1 / 3f); // Update the sword's angle with the responsiveness determined by mouse position. // Also flag for netcode sync if applicable (this is the only way the sword can rotate in multiplayer). @@ -195,14 +195,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Update the rolling "blade angular momentum" average by gently lerping in the newest data point. AngularDamageFactor = MathHelper.Lerp(AngularDamageFactor, deltaAngle, DamageUpdateResponsiveness); - // 0x expected speed gives you 53.5% damage. - // 1x expected speed gives you 100.0% damage. - // 1.5x expected speed gives you 116.6% damage. - // 2x expected speed gives you 130.6% damage. - // 3x expected speed gives you 153.5% damage. - // 4x expected speed gives you 171.7% damage. - // 5x expected speed gives you 187.0% damage. - float speedDamageScalar = 0.166f + (float)Math.Log(AngularDamageFactor / StandardSwingSpeed + 1.5f, 3f); + // 0x expected speed gives you 100.0% damage. + // 1x expected speed gives you 126.2% damage. + // 1.5x expected speed gives you 136.9% damage. + // 2x expected speed gives you 146.5% damage. + // 3x expected speed gives you 163.1% damage. + // 4x expected speed gives you 177.1% damage. + // 5x expected speed gives you 189.3% damage. + float speedDamageScalar = MathF.Log(AngularDamageFactor / StandardSwingSpeed + 3f, 3f); // Get the underlying sword item's current damage. This takes into account the player's stats and the sword's current charge. int damageWithChargeAndStats = player.GetWeaponDamage(player.ActiveItem()); @@ -278,8 +278,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float deltaAngle = Math.Abs(averageRotation - (MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi)); float opacity = Projectile.Opacity; opacity *= Utils.GetLerpValue(StandardSwingSpeed * 0.7f, StandardSwingSpeed, AngularDamageFactor, true); - opacity *= (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D); - opacity *= (float)Math.Pow(Utils.GetLerpValue(0.9f, 1.1f, deltaAngle, true), 2D); + opacity *= MathF.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4f); + opacity *= MathF.Pow(Utils.GetLerpValue(0.9f, 1.1f, deltaAngle, true), 2f); float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; float oldRotationAdjusted = MathHelper.WrapAngle(Projectile.oldRot[1]) + MathHelper.Pi; diff --git a/Projectiles/DraedonsArsenal/VulcanSpear.cs b/Projectiles/DraedonsArsenal/VulcanSpear.cs index 3d9bc39047..55707121f9 100644 --- a/Projectiles/DraedonsArsenal/VulcanSpear.cs +++ b/Projectiles/DraedonsArsenal/VulcanSpear.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool canStick = true; public int stuckTimer = 420; public Vector2 placementCenter; - Vector2 placementVelocity; + public override void SetDefaults() { Projectile.width = Projectile.height = 35; diff --git a/Projectiles/Enemy/GhostBellShock.cs b/Projectiles/Enemy/GhostBellShock.cs index aad4009344..4bbbb66073 100644 --- a/Projectiles/Enemy/GhostBellShock.cs +++ b/Projectiles/Enemy/GhostBellShock.cs @@ -132,8 +132,8 @@ namespace CalamityMod.Projectiles.Enemy int boltPoints = 12; // How many times can a bolt bend int minimumBolts = 6; // Minimum number of bolts int maximumBolts = 12; // Maximum number of bolts - int minimumSplits = 0; // Minimum number of split bolts - int maximumSplits = 2; // Maximum number of split bolts + //int minimumSplits = 0; // Minimum number of split bolts + //int maximumSplits = 2; // Maximum number of split bolts points.Clear(); bolts.Clear(); jellyBolts.Clear(); diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index c78db03e4c..52d7db66e3 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -38,7 +39,6 @@ namespace CalamityMod.Projectiles.Magic private Player Owner { get; set; } - private SlotId BigBeamSoundSlot; public int time = 0; public override void SetDefaults() { @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool() || isBigLaser) { - Dust laserDust = Dust.NewDustPerfect(randomLineEffectPosition, 278, Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f)); + Dust laserDust = Dust.NewDustPerfect(randomLineEffectPosition, DustID.FireworksRGB, Projectile.velocity * Main.rand.NextFloat(5f, 40f), Scale: Main.rand.NextFloat(0.8f, 1.1f)); laserDust.noGravity = true; laserDust.color = Main.rand.NextBool(3) ? color2 : color1; } diff --git a/Projectiles/Melee/LightspeedDashHitbox.cs b/Projectiles/Melee/LightspeedDashHitbox.cs new file mode 100644 index 0000000000..f4c9ddfe34 --- /dev/null +++ b/Projectiles/Melee/LightspeedDashHitbox.cs @@ -0,0 +1,72 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Sounds; +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LightspeedDashHitbox : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.penetrate = -1; + Projectile.timeLeft = 18; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + // Go where the player is going + Projectile.Center = Main.player[Projectile.owner].Center; + Main.player[Projectile.owner].velocity = Projectile.velocity; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.33f }, Projectile.Center); + + var player = Main.player[Projectile.owner]; + var modPlayer = player.Calamity(); + + // Refund 20 energy if dash hits. Can get energy from multiple enemies. + modPlayer.elementalMastery += 20; + modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy); + + // On-hit cut FX + int points = 2; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + + Particle spark = new RainbowGlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 14, 0.07f, Color.Aqua, new Vector2(0.55f, 0.825f), true, true, hueShift: 0.05f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < 12; i++) + { + Vector2 particleSpeed = Utils.SafeNormalize(target.Center, Vector2.One).RotatedByRandom(MathHelper.TwoPi * 3) * Main.rand.NextFloat(4f, 8f); + Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.4f, 0.9f), Color.OrangeRed, 50, 2, 2.5f, hueShift: 0.06f); + GeneralParticleHandler.SpawnParticle(energyLeak); + } + } + } +} diff --git a/Projectiles/Melee/LightspeedHoldout.cs b/Projectiles/Melee/LightspeedHoldout.cs new file mode 100644 index 0000000000..950233ac68 --- /dev/null +++ b/Projectiles/Melee/LightspeedHoldout.cs @@ -0,0 +1,430 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; +using static Terraria.Player; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Graphics.Primitives; +using System.Linq; +using Terraria.Graphics.Shaders; +using static CalamityMod.CalamityUtils; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Sounds; + + +namespace CalamityMod.Projectiles.Melee +{ + public class LightspeedHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Items/Weapons/Melee/Lightspeed"; + public ref float attackTimer => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public int time = 0; + + // Sprite visuals + public Vector2 innateOffset = new(23f, -0.1f); + public Vector2 handPos; + public float bladeRot = 0; + + // Primary + public int primaryStabfireRate => 2; + private int stabTimer; + public int stabSoundTimer = 3; + + // Secondary + public bool pressedRight = false; + public bool firstSecondaryIteration = false; + public int initialDirectionForThisAnim = 0; + public ref float DashState => ref Projectile.ai[1]; + public ref float DashTimer => ref Projectile.ai[2]; + private const float DashPrepTime = 40f; + private const float DashSpeed = 42f; + private const float DashDuration = 36f; + private const float DashAcceleration = 0.9865f; + private float AltSpinRotation = 0f; + public bool createdSmear = false; + public float LungeProgression + { + get + { + float duration = DashDuration; + float elapsed = DashDuration - (DashTimer * 2); + return MathHelper.Clamp(elapsed / duration, 0f, 1f); + } + } + + // General + public bool gotEnergyThisSwing = false; + public override bool? CanDamage() => false; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 120; + } + + public override void SetDefaults() + { + Projectile.width = 74; + Projectile.height = 94; + Projectile.friendly = true; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + } + + public void Positioning(Vector2 toMouse) // Hand and holdout positioning + { + if (DashState == 2) + { + Vector2 dashDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + Owner.ChangeDir(Math.Sign(dashDirection.X)); + + float dashArmRotation = dashDirection.ToRotation(); + float dashCompositeArmRotation = dashArmRotation + (MathHelper.TwoPi * 0.75f); + + Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, dashCompositeArmRotation); + Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); + + bladeRot = 0; + + handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, dashCompositeArmRotation); + + Projectile.Center = handPos; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + + // Visual rotation + Projectile.rotation = dashArmRotation; + Projectile.rotation = Projectile.velocity.ToRotation() + (Owner.direction == 1 ? MathHelper.PiOver4 : MathHelper.Pi * 0.75f); + Projectile.rotation += 0.15f * Owner.direction; // Adjustment to make the tip look like its more directly pointing at cursor + + // Item rotation (for arm positioning) + Owner.itemRotation = dashArmRotation + MathHelper.PiOver4; + + if (Owner.direction != 1) + { + Owner.itemRotation -= MathHelper.TwoPi * 0.75f; + } + + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + } + + else // If not in dash + { + Owner.ChangeDir(Math.Sign(toMouse.X)); + + float baseArmRotation = toMouse.ToRotation(); + float compositeArmRotation = baseArmRotation + bladeRot - MathHelper.PiOver2; + + Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, compositeArmRotation); + Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, 0f); + + Vector2 actualInnateOffset = innateOffset; + if (Owner.direction == -1) + { + actualInnateOffset.X += 1f; + actualInnateOffset.Y += 2f; + } + + handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.Full, compositeArmRotation) + actualInnateOffset.RotatedBy(baseArmRotation); + + Projectile.velocity = toMouse; + Projectile.rotation = toMouse.ToRotation() + bladeRot; + Projectile.rotation += MathHelper.PiOver2 * 0.5f; // Adjustment made so texture actually faces cursor + Projectile.rotation += 0.15f * Owner.direction; // Another to make the tip look like its more directly pointing at cursor + + if (Owner.direction == -1) + { + Projectile.rotation -= MathHelper.TwoPi * 0.75f; + } + + Projectile.Center = handPos; + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + + // Item rotation (for arm positioning) + Owner.itemRotation = Projectile.rotation - MathHelper.PiOver4; // Adjustment undone for arm pos + if (Owner.direction == -1) + { + Owner.itemRotation -= MathHelper.Pi; + } + else + { + Owner.itemRotation -= MathHelper.PiOver2; + } + + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + + } + } + + public override void AI() + { + Projectile.scale = 0.6f; + + if (!Owner.channel && DashState == 0) + { + Projectile.Kill(); + return; + } + + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()); + Positioning(toMouse); + + if (DashState == 0) + { + if (Owner.altFunctionUse == 2 && Owner.Calamity().mouseRight) + { + // Check if the player has enough EM + if (Owner.Calamity().elementalMastery < 100) + { + Projectile.Kill(); + return; + } + + DashState = 1; + DashTimer = DashPrepTime; + Projectile.localAI[0] = Owner.direction; + Owner.Calamity().elementalMastery = 0; // Reset EM to zero + } + } + + if (Owner.altFunctionUse == 0 && DashState == 0) + { + Projectile.Center += (Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()) * Main.rand.NextFloat(-5f, 8f)); + UsePrimary(toMouse); + } + + if (DashState > 0) + { + UseSecondary(); + } + } + + private void UsePrimary(Vector2 toMouse) + { + stabTimer++; + if (stabTimer % primaryStabfireRate != 0) + return; + + float offset = Main.rand.NextFloat(-MathHelper.ToRadians(10f), MathHelper.ToRadians(6f)); + Vector2 stabDir = toMouse.RotatedBy(offset); + + Vector2 stabOrigin = Projectile.Center; + Vector2 stabTip = stabOrigin + stabDir * 62f; + + for (int i = 0; i < 4; i++) + { + Vector2 spawnPos = stabTip + Main.rand.NextVector2Circular(18f, 12f); + Vector2 vel = stabDir * Main.rand.NextFloat(5f, 19f); + + Particle spark = new GlowSparkParticle(spawnPos, vel, false, Main.rand.Next(5, 8), Main.rand.NextFloat(0.02f, 0.07f), Color.Lerp(Color.Aqua, Color.OrangeRed, Main.rand.NextFloat(1f)) * 0.55f, new Vector2(Main.rand.NextFloat(0.475f, 0.535f), Main.rand.NextFloat(1.2f, 1.3f)), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle afterImage = new CustomSpark(Projectile.Center + (stabDir * 10f) + Main.rand.NextVector2Circular(4f, 11f), (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(), new("CalamityMod/Items/Weapons/Melee/Lightspeed"), false, Main.rand.Next(5,9), Projectile.scale * Main.rand.NextFloat(0.9f, 1.02f), Color.White * Main.rand.NextFloat(0.66f, 0.825f), new Vector2(1, 1), true, false, flipHorizontal: Owner.direction == -1 ? true : false); + GeneralParticleHandler.SpawnParticle(afterImage); + + // Make blade randomly vibrate + bladeRot = Main.rand.NextFloat(-0.12f, 0.3f) * Owner.direction; + Projectile.scale *= Main.rand.NextFloat(0.75f, 1f); + Projectile.Center += stabDir + Main.rand.NextVector2Circular(7f, 1.5f); + Projectile.Opacity = 0.925f; + + Owner.itemRotation += bladeRot * 0.1f; + // Make arm randomly vibrate + if (Main.rand.NextBool()) + { + Owner.SetCompositeArmFront(true, Main.rand.NextBool() ? CompositeArmStretchAmount.ThreeQuarters : CompositeArmStretchAmount.Quarter, Owner.itemRotation); + } + + stabSoundTimer++; + if (stabSoundTimer % 3 == 0) + { + SoundEngine.PlaySound(SoundID.Item1 with { Volume = 0.65f, MaxInstances = -1 }, Projectile.Center); + stabSoundTimer = 0; + } + + // Spawn the hitbox + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(Projectile.scale, 4), toMouse * 25, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + } + + private void UseSecondary() + { + Vector2 stabOrigin = Owner.MountedCenter; + Vector2 stabOffset = stabOrigin + Utils.DirectionTo(Owner.MountedCenter, Owner.ClampedMouseWorld()) * 30f; + Projectile.Center = stabOffset; + + + if (DashState == 1) // Initial delay + { + DashTimer--; + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + + Projectile.scale = 0.6f; + + if (!firstSecondaryIteration) + { + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Volume = 0.4f, Pitch = -0.05f }, Projectile.Center); + initialDirectionForThisAnim = Owner.direction; // Set for rest of the pre-dash anim so weird stuff doesnt happen when changing directions + firstSecondaryIteration = true; + } + + // Spin the blade around + if (DashTimer > 6) + { + float duration = DashPrepTime - 6; + float elapsed = duration - DashTimer; + + float t = MathHelper.Clamp(elapsed / duration, 0f, 1f); + float eased = MathF.Pow(t, 1.2f); + + AltSpinRotation = eased * (4f * MathHelper.Pi * 0.7175f); + float orbitalAngle = AltSpinRotation * initialDirectionForThisAnim + (initialDirectionForThisAnim == -1 ? MathHelper.Pi : 0); + float orbitRadius = 40f; + + Projectile.Center = Owner.Center + orbitalAngle.ToRotationVector2() * orbitRadius; + float tangentAngle = orbitalAngle + (initialDirectionForThisAnim == 1 ? MathHelper.PiOver4 : -MathHelper.PiOver4 + MathHelper.Pi); + Projectile.rotation = tangentAngle; + } + + // Mid-spin VFX + if (DashTimer < 32 && DashTimer > 8) + { + if (DashTimer % 4 == 0) + { + Vector2 pos = Owner.Center + Projectile.rotation.ToRotationVector2() * 60f; + Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.Aqua, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f, hueShift: 0.06f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + + Particle smear = new CircularSmearVFX(Owner.MountedCenter, Color.Aqua * 0.4f, Projectile.rotation, Projectile.scale * 1.66f); + GeneralParticleHandler.SpawnParticle(smear); + } + + // Initiate dash + if (DashTimer <= 0) + { + DashState = 2; + DashTimer = DashDuration; + + Vector2 toMouse = Owner.Center.DirectionTo(Owner.ClampedMouseWorld()); + Projectile.velocity = toMouse * DashSpeed; + + Owner.mount?.Dismount(Owner); + Owner.RemoveAllGrapplingHooks(); + + SoundEngine.PlaySound(Exoblade.DashSound, Owner.Center); + + SoundStyle otherSound = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(otherSound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.2f, 0.25f) }, Projectile.Center); + + Owner.immune = true; + Owner.immuneNoBlink = true; + Owner.immuneTime = (int) DashDuration + 2; + for (int k = 0; k < Owner.hurtCooldowns.Length; k++) + Owner.hurtCooldowns[k] = Owner.immuneTime; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 24, Projectile.knockBack * 4, Projectile.owner); + } + } + + else if (DashState == 2) // Dashing + { + DashTimer--; + + Vector2 dashVelocity = Projectile.velocity; + Owner.velocity = dashVelocity; + Owner.ChangeDir(Math.Sign(dashVelocity.X)); + + Projectile.velocity *= DashAcceleration; + + Projectile.scale = MathHelper.Lerp(1f, 0.3f, MathF.Pow(1f - DashTimer / DashDuration, 5)); + + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + + if (DashTimer <= 0) + { + Owner.velocity *= 0.1f; + Projectile.Kill(); + } + } + } + + // Drawcode below is mostly based on Exoblade's dash. + public float PierceWidthFunction(float completionRatio) + { + float width = Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * Projectile.scale * 24f; + //Fade it out starkly near the end of the lunge + width *= (1 - (float)Math.Pow(LungeProgression, 4)); + return width; + } + + public Color PierceColorFunction(float completionRatio) => Color.White * Projectile.Opacity; // The trail color doesnt matter here + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + int frameHeight = texture.Height / Main.projFrames[Projectile.type]; + Rectangle frame = new Rectangle(0, Projectile.frame * frameHeight, texture.Width, frameHeight); + Vector2 origin = new Vector2(texture.Width / 2f, frameHeight / 2f); + + SpriteEffects spriteEffects = Owner.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + lightColor = Color.White; // Fullbright + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + + DrawPierceTrail(); + + return false; + } + + public void DrawPierceTrail() + { + if (DashState != 2) + return; + + Main.spriteBatch.EnterShaderRegion(); + + Color mainColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f) % 1, Color.Aqua, Color.MediumAquamarine, Color.DarkOrange, Color.OrangeRed); + Color secondaryColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + 0.2f) % 1, Color.Aqua, Color.MediumAquamarine, Color.DarkOrange, Color.OrangeRed); + + mainColor = Color.Lerp(Color.White, mainColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f)); + secondaryColor = Color.Lerp(Color.White, secondaryColor, 0.4f + 0.6f * (float)Math.Pow(LungeProgression, 0.5f)); + + Vector2 trailOffset = Projectile.Size * 0.5f; + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); + 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(); + + // Lightspeed tracks 120 positions in oldPos. + // Provide 60 points for smoothing, but only render 30 + int numPointsRendered = 30; + int numPointsProvided = 60; + var positionsToUse = Projectile.oldPos.Take(numPointsProvided).ToArray(); + PrimitiveRenderer.RenderTrail(positionsToUse, new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), numPointsRendered); + + Main.spriteBatch.ExitShaderRegion(); + } + public override void OnKill(int timeLeft) + { + DashState = 0; + DashTimer = 0; + Projectile.scale = 0.6f; + } + } +} diff --git a/Projectiles/Melee/LightspeedM1Hitbox.cs b/Projectiles/Melee/LightspeedM1Hitbox.cs new file mode 100644 index 0000000000..5c991f7fd2 --- /dev/null +++ b/Projectiles/Melee/LightspeedM1Hitbox.cs @@ -0,0 +1,70 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.Projectiles.Melee +{ + [PierceResistExceptionAttribute(true)] + public class LightspeedM1Hitbox : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + + public bool gotEnergyThisSwing = false; + + public override void SetDefaults() + { + Projectile.width = 84; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 6; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 4; + } + + public override void AI() + { + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); + + float rotation = toMouse.ToRotation(); + + Projectile.rotation = rotation; + Projectile.velocity = toMouse * 34; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld() + MathHelper.Pi.ToRotationVector2()); + + if (!gotEnergyThisSwing) + { + gotEnergyThisSwing = true; + var player = Main.player[Projectile.owner]; + var modPlayer = player.Calamity(); + + // +4 energy on hit + modPlayer.elementalMastery += 4; + modPlayer.elementalMastery = Math.Min(modPlayer.elementalMastery, Lightspeed.MaxEnergy); + } + + for (int i = 0; i < 2; i++) + { + Vector2 particleSpeed = Utils.SafeNormalize(target.Center * toMouse, Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(7f, 14f); + Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.25f, 0.5f), Color.OrangeRed, 22, 2, 2.5f, hueShift: 0.06f); + GeneralParticleHandler.SpawnParticle(energyLeak); + } + } + } +} diff --git a/Projectiles/Melee/LucreciaProj.cs b/Projectiles/Melee/LucreciaProj.cs index f2650eeed2..5fc7436e6d 100644 --- a/Projectiles/Melee/LucreciaProj.cs +++ b/Projectiles/Melee/LucreciaProj.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee if (timer % 8 == 0) { Vector2 pos = player.Center + Projectile.rotation.ToRotationVector2() * 60f; - Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat()), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); + Particle sparkle = new CritSpark(pos, new Vector2(7f, 0).RotatedBy(Projectile.rotation), Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(1f)), Color.White * 0.33f, 1.2f, 12, 0.3f, 1.2f); GeneralParticleHandler.SpawnParticle(sparkle); } Particle smear = new CircularSmearVFX(player.Center, Color.CornflowerBlue * 0.25f, Projectile.rotation, Projectile.scale * 1.25f); diff --git a/Projectiles/Melee/Shortswords/StarburstShivProj.cs b/Projectiles/Melee/Shortswords/StarburstShivProj.cs deleted file mode 100644 index 8293e62d06..0000000000 --- a/Projectiles/Melee/Shortswords/StarburstShivProj.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -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 StarburstShivProj : BaseShortswordProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Melee/StarburstShiv"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 44; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.scale = 1f; - Projectile.DamageType = TrueMeleeDamageClass.Instance; - Projectile.ownerHitCheck = true; - Projectile.timeLeft = 360; - Projectile.extraUpdates = 1; - Projectile.hide = true; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override Action EffectBeforePullback => (proj) => - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - }; - - public override void SetVisualOffsets() - { - const int HalfSpriteWidth = 37; - const int HalfSpriteHeight = 47; - - int HalfProjWidth = Projectile.width / 2; - int QuarterProjHeight = Projectile.height / 4; - - DrawOriginOffsetX = 0; - DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); - DrawOriginOffsetY = -(HalfSpriteHeight - QuarterProjHeight); - } - - public override void ExtraBehavior() - { - if (Main.rand.NextBool(5)) - { - int rainbowDust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[rainbowDust].velocity *= 0.2f; - Main.dust[rainbowDust].noGravity = true; - } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/StarburstBeam.cs b/Projectiles/Melee/StarburstBeam.cs deleted file mode 100644 index 788aa3c149..0000000000 --- a/Projectiles/Melee/StarburstBeam.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class StarburstBeam : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 2; - Projectile.tileCollide = false; - Projectile.timeLeft = 60; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].velocity = Vector2.Zero; - - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 50) - return false; - - return true; - } - - public override void OnKill(int timeLeft) - { - for (int k = 0; k < 2; k++) - { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[rainbow].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 30); - OnHitEffects(target.Center); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - OnHitEffects(target.Center); - } - - private void OnHitEffects(Vector2 targetPos) - { - var source = Projectile.GetSource_FromThis(); - for (int x = 0; x < 3; x++) - { - if (Projectile.owner == Main.myPlayer) - { - CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, false, 50f); - } - } - } - } -} diff --git a/Projectiles/Melee/StarburstBeam.png b/Projectiles/Melee/StarburstBeam.png deleted file mode 100644 index 01a8a875ef..0000000000 Binary files a/Projectiles/Melee/StarburstBeam.png and /dev/null differ diff --git a/Projectiles/Melee/StarburstSHIV.cs b/Projectiles/Melee/StarburstSHIV.cs deleted file mode 100644 index 6bdbcae1a7..0000000000 --- a/Projectiles/Melee/StarburstSHIV.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class StarburstSHIV : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 15; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 90; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); - - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].velocity = Vector2.Zero; - } - - public override void OnKill(int timeLeft) - { - int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RainbowTorch, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[rainbow].noGravity = true; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 85) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Melee/StarburstSHIV.png b/Projectiles/Melee/StarburstSHIV.png deleted file mode 100644 index 01a8a875ef..0000000000 Binary files a/Projectiles/Melee/StarburstSHIV.png and /dev/null differ diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 183a1b9d1a..850635fff0 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; private const float Radius = 100f; - private SlotId mmmmmm; private bool spawnedAura = false; public int soundCooldown = 0; diff --git a/Projectiles/Pets/FrostyBatPet.cs b/Projectiles/Pets/FrostyBatPet.cs new file mode 100644 index 0000000000..0b4d6c7da9 --- /dev/null +++ b/Projectiles/Pets/FrostyBatPet.cs @@ -0,0 +1,151 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class FrostyBatPet : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Pets"; + public Player Owner => Main.player[Projectile.owner]; + public Color effectColor = Color.CornflowerBlue; + public ref float time => ref Projectile.ai[0]; + public float flapMult = 0; + public int flapTime = 0; + public int flapRate = 5; + public Vector2 goalPosition; + public Vector2 dashDirection; + public int dashingTimer = 0; + public int dashLength = 120; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 8; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + public override void AI() + { + if (VerifyOwnerIsPresent()) + return; + + HandleFrames(); + + int maxFlapTime = flapRate * Main.projFrames[Type]; + if (Projectile.frame == 4) + { + if (flapTime == 0) + flapTime = maxFlapTime; + float lerp = 1 - (float)Math.Pow(Utils.GetLerpValue(flapRate - 1, 0, Projectile.frameCounter % flapRate), 1.75f); + flapMult = CalamityUtils.EaseInOutExp(lerp, 2.5f, 1f); + } + else + flapMult = 1 - (float)Math.Pow(Utils.GetLerpValue(maxFlapTime, 1, flapTime), 3); + if (flapTime > 0) + flapTime--; + + float sine = (float)Math.Sin(time * 0.05f / MathHelper.Pi); + float sine2 = (float)Math.Sin((time * 0.05f / MathHelper.Pi) * 2); + + if (dashingTimer == 0) + goalPosition = Owner.Center + new Vector2(45 * sine, -60 + 10 * sine2); + + float dashIntensity = 1 - Math.Abs(Utils.GetLerpValue(dashLength / 2, 0, dashingTimer)); + if (Owner.dashDelay == -1 && dashingTimer == 0) + { + dashingTimer = dashLength; + Projectile.extraUpdates = 1; + dashDirection = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + } + if (dashingTimer > 0) + { + float velPower = (float)Math.Pow(Owner.velocity.Length(), 0.75f) * 35; + goalPosition = Owner.Center + dashDirection * (250 + velPower) * dashIntensity; + + float opacity = Utils.GetLerpValue(6, 12, Projectile.velocity.Length(), true) * 0.25f + 0.05f; + Particle iceMist = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 14f, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.3f, 1f) + Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), "CalamityMod/Particles/BloomCircle", false, 22, Main.rand.NextFloat(0.3f, 0.55f), effectColor * opacity, new Vector2(1f, 1.3f), true, true, glowOpacity: opacity, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi), spin: Main.rand.NextFloat(-0.1f, 0.1f)); + GeneralParticleHandler.SpawnParticle(iceMist); + } + else if (Projectile.extraUpdates > 0) + Projectile.extraUpdates = 0; + + float followSpeed = 10; + Projectile.velocity = (goalPosition - Projectile.Center) / (followSpeed); + + Projectile.rotation = Projectile.velocity.X * 0.035f; + + // Emit light. + float tileCollideMult = !Collision.SolidCollision(Projectile.Center, 2, 2) ? 1 : (dashingTimer > 0 ? Math.Max(Utils.GetLerpValue(dashLength * 0.8f, dashLength, dashingTimer, true), 0.15f) : 1); + if (tileCollideMult > 0) + Lighting.AddLight(Projectile.Center, effectColor.ToVector3() * (0.65f + 0.5f * dashIntensity) * tileCollideMult); + + if (Main.rand.NextBool(15 / (dashingTimer != 0 ? 3 : 1))) + { + Vector2 vel = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + Particle iceFlake = new CustomSpark(Projectile.Center + vel * 9, vel * Main.rand.NextFloat(0.3f, 1.5f) + Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f), "CalamityMod/Particles/GlowFlakeParticle", false, Main.rand.Next(25, 35), Main.rand.NextFloat(0.2f, 0.45f) + (dashingTimer > 0 ? 0.2f : 0), effectColor * 0.7f, new Vector2(1f, 1f), true, true, glowOpacity: 0.8f, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi), spin: Main.rand.NextFloat(-0.3f, 0.3f)); + GeneralParticleHandler.SpawnParticle(iceFlake); + } + + time++; + if (dashingTimer > 0) + dashingTimer--; + } + + public bool VerifyOwnerIsPresent() + { + // No logic should be run if the player is no longer active in the game. + if (!Owner.active) + { + Projectile.Kill(); + return true; + } + + if (Owner.dead) + Owner.Calamity().frostyBat = false; + if (Owner.Calamity().frostyBat) + Projectile.timeLeft = 2; + + return false; + } + + public void HandleFrames() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / flapRate % Main.projFrames[Type]; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D glow = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float sine = (float)Math.Sin((time * 0.05f / MathHelper.Pi) * 3); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, 7) * MathHelper.Lerp(1 , -1, flapMult); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + + Rectangle frame = texture.Frame(1, 8, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(glow, drawPosition, null, effectColor with { A = 0 } * (0.3f + 0.65f * i), Projectile.rotation, glow.Size() * 0.5f, new Vector2(1.2f, 1f) * Projectile.scale * (0.5f + sine * 0.05f * (1 - i) - 0.3f * i), Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Summon/FrostbatMinion.png b/Projectiles/Pets/FrostyBatPet.png similarity index 100% rename from Projectiles/Summon/FrostbatMinion.png rename to Projectiles/Pets/FrostyBatPet.png diff --git a/Projectiles/Pets/ToastyBatPet.cs b/Projectiles/Pets/ToastyBatPet.cs new file mode 100644 index 0000000000..bf1f326f09 --- /dev/null +++ b/Projectiles/Pets/ToastyBatPet.cs @@ -0,0 +1,135 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class ToastyBatPet : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Pets"; + public Player Owner => Main.player[Projectile.owner]; + public Color effectColor = Color.OrangeRed; + public float flapMult = 0; + public int flapTime = 0; + public int flapRate = 3; + public Vector2 goalPosition; + public ref float time => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 8; + Main.projPet[Type] = true; + ProjectileID.Sets.LightPet[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + public override void AI() + { + if (VerifyOwnerIsPresent()) + return; + + HandleFrames(); + + int maxFlapTime = flapRate * Main.projFrames[Type]; + if (Projectile.frame == 4) + { + if (flapTime == 0) + flapTime = maxFlapTime; + float lerp = 1 - (float)Math.Pow(Utils.GetLerpValue(flapRate - 1, 0, Projectile.frameCounter % flapRate), 1.75f); + flapMult = CalamityUtils.EaseInOutExp(lerp, 2.5f, 1f); + } + else + flapMult = 1 - (float)Math.Pow(Utils.GetLerpValue(maxFlapTime, 1, flapTime), 3); + if (flapTime > 0) + flapTime--; + + float sine = (float)Math.Sin(time * 0.08f / MathHelper.Pi); + float sine2 = (float)Math.Sin((time * 0.08f / MathHelper.Pi) * 2); + + goalPosition = Owner.Center + new Vector2(35 * sine, -50 + 15 * sine2) + Owner.velocity * 8.5f; + + float followSpeed = 5.5f; + Projectile.velocity = (goalPosition - Projectile.Center) / (followSpeed); + + Projectile.rotation = Projectile.velocity.X * 0.035f; + + // Emit light. + Lighting.AddLight(Projectile.Center, Color.Lerp(effectColor, Color.White, 0.6f).ToVector3() * 0.9f); + + float speedMult = Utils.GetLerpValue(4, 8, Owner.velocity.Length(), true); + if (Main.rand.NextBool((int)(20 - 15 * speedMult))) + { + Vector2 vel = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 4, ModContent.DustType(), vel * Main.rand.NextFloat(0.1f, 0.5f) + Projectile.velocity * Main.rand.NextFloat(0.3f, 0.75f), 0, default, Main.rand.NextFloat(0.4f, 0.7f)); + dust.noGravity = true; + dust.color = effectColor; + dust.noLightEmittence = false; + dust.fadeIn = -0.95f; + } + if (Main.rand.NextBool((int)(10 - 7 * speedMult)) || speedMult >= 1) + { + Vector2 vel = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + Particle fireFlake = new CustomSpark(Projectile.Center + vel * 3, vel * Main.rand.NextFloat(0.1f, 0.3f) + Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(35, 45), Main.rand.NextFloat(0.3f, 0.45f), effectColor * 0.2f, new Vector2(1f, 1f), true, true, glowOpacity: 0.2f, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi), noShrink: true, spin: Main.rand.NextFloat(-0.2f, 0.2f)); + GeneralParticleHandler.SpawnParticle(fireFlake); + } + + time++; + } + + public bool VerifyOwnerIsPresent() + { + // No logic should be run if the player is no longer active in the game. + if (!Owner.active) + { + Projectile.Kill(); + return true; + } + + if (Owner.dead) + Owner.Calamity().toastyBat = false; + if (Owner.Calamity().toastyBat) + Projectile.timeLeft = 2; + + return false; + } + + public void HandleFrames() + { + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / flapRate % Main.projFrames[Type]; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D glow = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float sine = (float)Math.Sin((time * 0.08f / MathHelper.Pi) * 3); + + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, 7) * MathHelper.Lerp(1, -1, flapMult); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + + Rectangle frame = texture.Frame(1, 8, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(glow, drawPosition, null, effectColor with { A = 0 } * (0.3f + 0.65f * i), Projectile.rotation, glow.Size() * 0.5f, new Vector2(1.2f, 1f) * Projectile.scale * (0.5f + sine * 0.05f * (1 - i) - 0.3f * i), Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Summon/FlarebatMinion.png b/Projectiles/Pets/ToastyBatPet.png similarity index 100% rename from Projectiles/Summon/FlarebatMinion.png rename to Projectiles/Pets/ToastyBatPet.png diff --git a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs index bfda144189..80a5a169ba 100644 --- a/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs +++ b/Projectiles/Ranged/ArcNovaDiffuserHoldout.cs @@ -1,8 +1,11 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -18,12 +21,21 @@ namespace CalamityMod.Projectiles.Ranged public override float OffsetXUpwards => -5f; public override float BaseOffsetY => -5f; public override float OffsetYDownwards => 5f; + public override float RecoilResolveSpeed => (KeepRefreshingLifetime || CurrentChargingFrames < ArcNovaDiffuser.Charge2Frames) ? 0.4f : 0.04f; public static int FramesPerLoad = 13; public static int MaxLoadableShots = 15; public static float BulletSpeed = 12f; public SlotId NovaChargeSlot; + public Vector2 effectSpot; + public float effectScale = 0; + public Vector2 effectSpot2; + public float effectScale2 = 0; + public Vector2 effectSpot3; + public float effectScale3 = 0; + public int time = 0; + public ref float CurrentChargingFrames => ref Projectile.ai[0]; public ref float ShotsLoaded => ref Projectile.ai[1]; public ref float ShootRecoilTimer => ref Projectile.ai[2]; // Dual functions for rapid fire shooting cooldown and recoil @@ -55,21 +67,37 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = ArcNovaDiffuser.AftershotCooldownFrames * 2; ChargeSound?.Stop(); - SoundEngine.PlaySound(ArcNovaDiffuser.BigShot, Projectile.position); + SoundEngine.PlaySound(ArcNovaDiffuser.BigShot, Projectile.Center); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; - int charge2Damage = Projectile.damage * 20; + int charge2Damage = (int)(Projectile.damage * 9f); float charge2KB = Projectile.knockBack * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), charge2Damage, charge2KB, Projectile.owner); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), charge2Damage, charge2KB, Projectile.owner); Owner.Calamity().GeneralScreenShakePower = 6.5f; - for (int i = 0; i <= 25; i++) + for (int i = 0; i <= 45; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.2f, 1.2f), 0, default, Main.rand.NextFloat(1f, 2.3f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.6f, 1.9f), 0, default, Main.rand.NextFloat(2f, 3.3f)); dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + dust.fadeIn = 2.5f; + if (Main.rand.NextBool(4)) + { + dust.scale = Main.rand.NextFloat(0.8f, 0.95f); + dust.fadeIn = -0.85f; + dust.velocity /= 2; + } } + for (int i = 0; i < 2; i++) + { + Particle spark2 = new CustomSpark(GunTipPosition, Projectile.velocity * 25, "CalamityMod/Particles/BloomCircle", false, 16, 0.95f, ArcNovaDiffuser.mainColor, new Vector2(1.8f, 0.8f), true, true, glowOpacity: 0.9f, shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(spark2); + } + Particle spark = new CustomSpark(GunTipPosition, Projectile.velocity * 2, "CalamityMod/Particles/BloomRing", false, 12, 0.7f, ArcNovaDiffuser.mainColor, new Vector2(0.5f, 1.5f), true, false, extraRotation: -MathHelper.PiOver2, noShrink: true); + GeneralParticleHandler.SpawnParticle(spark); ShotsLoaded = 0; - ShootRecoilTimer = 24f; + ShootRecoilTimer = Projectile.timeLeft = 55; OffsetLengthFromArm -= 25f; } // Retracting recoil @@ -88,36 +116,34 @@ namespace CalamityMod.Projectiles.Ranged if (ShootRecoilTimer <= 0f) { ChargeSound?.Stop(); - SoundEngine.PlaySound(ArcNovaDiffuser.SmallShot, Projectile.position); + SoundEngine.PlaySound(ArcNovaDiffuser.SmallShot, Projectile.Center); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; Vector2 fireVec = shootVelocity.RotatedByRandom(MathHelper.ToRadians(2f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec * (ChargeLV1 ? 1 : 0.7f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); for (int i = 0; i <= 4; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, 107, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition - Projectile.velocity * 15, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(1.2f, 1.6f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + dust.fadeIn = 1.5f; + if (Main.rand.NextBool(6)) + { + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.fadeIn = -0.85f; + dust.velocity /= 2; + } } ShotsLoaded--; - ShootRecoilTimer = 16f; - OffsetLengthFromArm -= 5f; + ShootRecoilTimer = (int)MathHelper.Lerp(33, 13, Math.Min(CurrentChargingFrames / ArcNovaDiffuser.Charge1Frames, 1)); + OffsetLengthFromArm -= 6f; } } // Retracting any remaining recoil else if (ShootRecoilTimer > 0) ShootRecoilTimer -= 2; - - // Fires a burst of sparks on the last shot - if (ShotsLoaded == 0) - { - for (int i = 0; i < 6; i++) - { - SparkParticle spark2 = new SparkParticle((GunTipPosition - Projectile.velocity * 3) + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * Main.rand.NextFloat(9.1f, 17.8f), false, Main.rand.Next(9, 12), Main.rand.NextFloat(0.2f, 0.3f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); - GeneralParticleHandler.SpawnParticle(spark2); - } - ShotsLoaded--; - } } else { @@ -152,16 +178,6 @@ namespace CalamityMod.Projectiles.Ranged if (CurrentChargingFrames >= 10) { float particleScale = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames); - for (int i = 0; i < (ChargeLV2 ? 4 : ChargeLV1 ? 3 : 2); i++) - { - SparkParticle spark2 = new SparkParticle((GunTipPosition - Projectile.velocity * 4) + Main.rand.NextVector2Circular(12, 12), -Projectile.velocity * Main.rand.NextFloat(16.1f, 30.8f), false, Main.rand.Next(2, 7), Main.rand.NextFloat(particleScale / 350f, particleScale / 270f), Main.rand.NextBool(4) ? Color.Chartreuse : Color.Lime); - GeneralParticleHandler.SpawnParticle(spark2); - } - Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Color.Lime, particleScale / 270f, 2, false); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.White, particleScale / 400f, 2, false); - GeneralParticleHandler.SpawnParticle(orb2); - float strength = particleScale / 45f; Vector3 DustLight = new Vector3(0.000f, 0.255f, 0.000f); Lighting.AddLight(GunTipPosition, DustLight * strength); @@ -170,25 +186,30 @@ namespace CalamityMod.Projectiles.Ranged // Full charge dusts if (CurrentChargingFrames == ArcNovaDiffuser.Charge1Frames) { - for (int i = 0; i < 36; i++) + for (int i = 0; i < 25; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 107); - chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 8f + Owner.velocity; - chargefull.scale = Main.rand.NextFloat(1f, 1.3f); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * Main.rand.NextFloat(8, 9.5f); + chargefull.scale = Main.rand.NextFloat(1.2f, 1.5f); chargefull.noGravity = true; + chargefull.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + chargefull.fadeIn = 1; } } if (CurrentChargingFrames == ArcNovaDiffuser.Charge2Frames) { - for (int i = 0; i < 45; i++) + for (int i = 0; i < 35; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 107); - chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 12f + Owner.velocity; - chargefull.scale = Main.rand.NextFloat(1.2f, 1.4f); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 35f).ToRotationVector2() * Main.rand.NextFloat(11, 13.5f); + chargefull.scale = Main.rand.NextFloat(1.7f, 1.9f); chargefull.noGravity = true; + chargefull.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + chargefull.fadeIn = 1; } } } + time++; } public override void OnKill(int timeLeft) @@ -199,20 +220,52 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { + if (time < 2) + return false; Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 tipDrawPosition = GunTipPosition - Main.screenPosition; float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Color color = ArcNovaDiffuser.mainColor; + float chargeScale = KeepRefreshingLifetime ? Math.Min(Utils.GetLerpValue(0, ArcNovaDiffuser.Charge1Frames, CurrentChargingFrames, false), 2) : 0; if (!Owner.CantUseHoldout()) { float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames); drawPosition += Main.rand.NextVector2Circular(rumble / 70f, rumble / 70f); } + float sine = (float)Math.Sin(time * 0.15f / MathHelper.Pi); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * (2f + sine * 0.3f); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, color with { A = 0 } * Math.Min(chargeScale, 1) * 0.3f, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0); + } + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Asset tex3 = ModContent.Request("CalamityMod/Particles/ForwardSmear"); + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + for (int i = 0; i < 4; i++) + { + Vector2 place = Vector2.One.RotateRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1, 5.5f) * Math.Min(chargeScale, 1); + Vector2 vel = Projectile.velocity.RotatedByRandom(0.3f); + Main.EntitySpriteDraw(tex3.Value, tipDrawPosition + place - Vector2.Lerp(place, -Projectile.velocity, 0.9f) * Main.rand.NextFloat(15, 35) + Projectile.velocity * -8 * (6 - chargeScale * 2), null, (Main.rand.NextBool(3) ? Color.Lime : color) with { A = 0 } * 0.8f * Math.Min(chargeScale, 1), vel.ToRotation() - MathHelper.PiOver2, new Vector2(tex3.Width() / 2, tex3.Height()), new Vector2(0.25f * chargeScale, (1.7f + (Main.rand.NextBool(4) ? 1.8f : 0))) * Projectile.scale * 0.05f * Math.Min(chargeScale, 1), SpriteEffects.None, 0); + } + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2.Value, tipDrawPosition, null, Color.Lerp(color, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.23f, SpriteEffects.None, 0); + if (CurrentChargingFrames >= ArcNovaDiffuser.Charge2Frames) + { + for (int y = 0; y < 3; y++) + { + Vector2 angleVel = (MathHelper.TwoPi * y / 3f).ToRotationVector2().RotatedBy(time * 0.18f); + Vector2 drawOffset = (new Vector2(angleVel.X * 0.7f, angleVel.Y * 1.2f)).RotatedBy(Projectile.rotation) * chargeScale * 12; + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex2.Value, tipDrawPosition + drawOffset, null, Color.Lerp(color, Color.White, i) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1f, 1f) * Projectile.scale * chargeScale * (1 - 0.25f * i) * 0.085f * (CurrentChargingFrames <= ArcNovaDiffuser.Charge2Frames + 3 ? 3 : 1), SpriteEffects.None, 0); + } + } return false; } } diff --git a/Projectiles/Ranged/FlashRoundFlash.cs b/Projectiles/Ranged/FlashRoundFlash.cs index ecd6d8841e..ae7f6c8b1c 100644 --- a/Projectiles/Ranged/FlashRoundFlash.cs +++ b/Projectiles/Ranged/FlashRoundFlash.cs @@ -30,8 +30,6 @@ namespace CalamityMod.Projectiles.Ranged if (Utils.Distance(target.Center, Projectile.Center) <= Projectile.width) { Player Owner = Main.player[Projectile.owner]; - target.AddBuff(BuffID.Confused, 180); - Vector2 launchVel = Utils.DirectionTo(Owner.Center, Projectile.Center); target.MoveNPC(launchVel, 5, false); diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index bab429e622..51615c3a6a 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -126,8 +126,8 @@ namespace CalamityMod.Projectiles.Ranged dust.color = Color.White; dust.noLightEmittence = true; } - // Doesn't actually do damage, just an aoe for confustion infliction and knockback - Projectile flash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 5, 0f, Projectile.owner); + // Doesn't actually do damage, just an aoe for knockback + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 5, 0f, Projectile.owner); } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Ranged/M1GarandEmptyClip.cs b/Projectiles/Ranged/M1GarandEmptyClip.cs index e04b8068b6..ea2854972c 100644 --- a/Projectiles/Ranged/M1GarandEmptyClip.cs +++ b/Projectiles/Ranged/M1GarandEmptyClip.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Ranged public static float UsedCoinGrabRangeMultiplier = 5f; public static float ClipTossForce = 7.33f; + public float midAirRot = 0f; public static float MaxIntraClipRicoshotDistance = 1000f; @@ -88,7 +89,9 @@ namespace CalamityMod.Projectiles.Ranged d.noGravity = true; } - Projectile.rotation = Projectile.velocity.X * 0.5f; + + midAirRot += 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.5f + midAirRot; if (Projectile.FinalExtraUpdate()) { diff --git a/Projectiles/Ranged/M1GarandHoldout.cs b/Projectiles/Ranged/M1GarandHoldout.cs index 53fffd9202..94301063f8 100644 --- a/Projectiles/Ranged/M1GarandHoldout.cs +++ b/Projectiles/Ranged/M1GarandHoldout.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged // Muzzle flash textures public static Asset MuzzleFlash; - public static Asset GlowTexture; + public static Asset HoldoutGlow; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFire") { PitchVariance = 0.1f }; public static readonly SoundStyle PingSound = new("CalamityMod/Sounds/Item/M1GarandPing"); @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Load() { MuzzleFlash = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad); - GlowTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandHoldoutGlow", AssetRequestMode.ImmediateLoad); + HoldoutGlow = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandHoldoutGlow", AssetRequestMode.ImmediateLoad); } public override void SetStaticDefaults() => Main.projFrames[Type] = 6; @@ -267,7 +267,7 @@ namespace CalamityMod.Projectiles.Ranged { if (pingAnimationTimer <= PingAnimationDuration) { - Texture2D pingTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandPingText").Value; + Texture2D pingTexture = Main.zenithWorld ? ModContent.Request("CalamityMod/Particles/MammothParticle").Value : ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandPingText").Value; Vector2 origin = pingTexture.Size() * 0.5f; Vector2 pingDrawPosition; @@ -344,7 +344,7 @@ namespace CalamityMod.Projectiles.Ranged { Texture2D texture = TextureAssets.Projectile[Type].Value; Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Math.Clamp(Projectile.frame, 0, Main.projFrames[Type] - 1)); - Texture2D glowTexture = GlowTexture.Value; + Texture2D glowTexture = HoldoutGlow.Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); diff --git a/Projectiles/Ranged/MagnaCannonHoldout.cs b/Projectiles/Ranged/MagnaCannonHoldout.cs index ef4ea8c38e..ca14d3554f 100644 --- a/Projectiles/Ranged/MagnaCannonHoldout.cs +++ b/Projectiles/Ranged/MagnaCannonHoldout.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Particles; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Ranged public class MagnaCannonHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); - public override float MaxOffsetLengthFromArm => 20f; + public override float MaxOffsetLengthFromArm => 28f; public override float OffsetXUpwards => -5f; public override float BaseOffsetY => -5f; @@ -26,6 +27,7 @@ namespace CalamityMod.Projectiles.Ranged public static int FramesPerLoad = 9; public static int MaxLoadableShots = 20; public static float BulletSpeed = 12f; + public int time = 0; public override void KillHoldoutLogic() { @@ -59,9 +61,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(9f)), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * (FullyCharged ? 3 : 1), Projectile.owner); for (int i = 0; i <= 3; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 187, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.9f, 1.2f), 0, default, Main.rand.NextFloat(1.5f, 2.3f)); - dust.noGravity = true; + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.2f, 0.9f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool(3) ? Color.DodgerBlue : Color.RoyalBlue; + dust.fadeIn = 0.3f; } + OffsetLengthFromArm -= 5f; ShotsLoaded--; ShootTimer = FullyCharged ? 4f : 5f; @@ -90,16 +95,8 @@ namespace CalamityMod.Projectiles.Ranged // Charge-up visuals if (CurrentChargingFrames >= 10) { - if (!FullyCharged) - { - Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.06f + (CurrentChargingFrames / 180), 0.08f + (CurrentChargingFrames / 180)), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(0.3f * CurrentChargingFrames, 0.3f * CurrentChargingFrames), 0f, Color.White, Color.Aqua, 7, GunTipPosition); - GeneralParticleHandler.SpawnParticle(streak); - } - float orbScale = MathHelper.Clamp(CurrentChargingFrames, 0f, MagnaCannon.FullChargeFrames); - Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Color.DarkBlue, orbScale / 135f, 2); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.Aqua, orbScale / 200f, 2); - GeneralParticleHandler.SpawnParticle(orb2); + float orbScale = MathHelper.Clamp(CurrentChargingFrames, 0f, MagnaCannon.FullChargeFrames) / 200; + Lighting.AddLight(GunTipPosition, Color.DodgerBlue.ToVector3() * orbScale); } // Full charge dusts @@ -107,13 +104,16 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 36; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 160); - chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 18f + Owner.velocity; - chargefull.scale = Main.rand.NextFloat(1f, 1.5f); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * Main.rand.NextFloat(6, 7.5f); + chargefull.scale = Main.rand.NextFloat(2f, 2.5f); chargefull.noGravity = true; + chargefull.color = Main.rand.NextBool(3) ? Color.Cyan : Color.RoyalBlue; + chargefull.fadeIn = 1; } } } + time++; } public override void OnKill(int timeLeft) @@ -124,6 +124,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { + if (time < 2) + return false; Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); @@ -136,8 +138,14 @@ namespace CalamityMod.Projectiles.Ranged drawPosition += Main.rand.NextVector2Circular(rumble / 43f, rumble / 43f); } + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + float chargeScale = KeepRefreshingLifetime ? Utils.GetLerpValue(0, MagnaCannon.FullChargeFrames, CurrentChargingFrames, true) : 0; + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.DodgerBlue : Color.RoyalBlue, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.25f * ((chargeScale >= 1 && CurrentChargingFrames <= MagnaCannon.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), SpriteEffects.None, 0); + return false; } } diff --git a/Projectiles/Ranged/MagnaShot.cs b/Projectiles/Ranged/MagnaShot.cs index 4538ed3922..dac9fbc59e 100644 --- a/Projectiles/Ranged/MagnaShot.cs +++ b/Projectiles/Ranged/MagnaShot.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -19,36 +20,41 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.width = Projectile.height = 5; Projectile.friendly = true; - Projectile.alpha = 25; Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 50; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Dust dust = Dust.NewDustPerfect(Projectile.Center, 187); - dust.noGravity = true; - dust.scale = 0.5f; + + Vector2 trailPos = Projectile.Center + Main.rand.NextVector2Circular(4, 4) - Projectile.velocity; + float trailScale = Main.rand.NextFloat(0.04f, 0.05f); + Color trailColor = Main.rand.NextBool(3) ? Color.DodgerBlue : Color.RoyalBlue; + Particle Trail = new CustomSpark(trailPos, Projectile.velocity.RotatedByRandom(0.03f) * Main.rand.NextFloat(0.1f, 0.4f), "CalamityMod/Particles/SquareRotated", false, Main.rand.NextBool(7) ? 35 : 6, trailScale, trailColor, new Vector2(1f, 1f), true, true, glowOpacity: 0.5f, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(Trail); + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.DodgerBlue with { A = 0 }, 1); return false; } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 3; i++) + for (int i = 0; i <= 2; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.position, 187, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) / 2, 0, default, Main.rand.NextFloat(1.1f, 1.3f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.8f, 1.8f), 0, default, Main.rand.NextFloat(0.9f, 1.3f)); dust.noGravity = false; - SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.8f, PitchVariance = 0.3f }, Projectile.Center); + dust.color = Main.rand.NextBool(3) ? Color.DodgerBlue : Color.RoyalBlue; + dust.fadeIn = -0.15f; } + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.8f, PitchVariance = 0.3f }, Projectile.Center); } public override bool? CanDamage() => base.CanDamage(); } diff --git a/Projectiles/Ranged/NovaChargedShot.cs b/Projectiles/Ranged/NovaChargedShot.cs index 8839304a71..63bb4b40ca 100644 --- a/Projectiles/Ranged/NovaChargedShot.cs +++ b/Projectiles/Ranged/NovaChargedShot.cs @@ -1,4 +1,7 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -35,19 +38,32 @@ namespace CalamityMod.Projectiles.Ranged { Time++; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(-3, 3), 107); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(-3, 3), ModContent.DustType()); dust.noGravity = true; - dust.scale = 1.2f; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.color = ArcNovaDiffuser.mainColor; + dust.fadeIn = -0.4f; if (Time < 120) { if (Main.rand.NextBool()) { Vector2 trailPos = Projectile.Center + Main.rand.NextVector2Circular(10, 10); - float trailScale = Main.rand.NextFloat(0.8f, 1.2f); - Color trailColor = Main.rand.NextBool(3) ? Color.Chartreuse : Color.Lime; - Particle Trail = new SparkParticle(trailPos, Projectile.velocity * 0.2f, false, 60, trailScale, trailColor); + float trailScale = Main.rand.NextFloat(0.6f, 0.75f); + Color trailColor = Main.rand.NextBool(3) ? Color.Chartreuse : ArcNovaDiffuser.mainColor; + Particle Trail = new CustomSpark(trailPos, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 50, trailScale, trailColor, new Vector2(0.2f, 1.4f), true, true, shrinkSpeed: 0.1f); GeneralParticleHandler.SpawnParticle(Trail); } + if (Time % 2 == 0) + { + for (int i = -1; i <= 1; i += 2) + { + float sine = (float)Math.Sin(Projectile.timeLeft * 0.45f / MathHelper.Pi); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 28 * i, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(0.6f, 0.8f), 0, default, Main.rand.NextFloat(0.8f, 0.85f)); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + dust2.fadeIn = -0.55f; + } + } } @@ -59,45 +75,43 @@ namespace CalamityMod.Projectiles.Ranged } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 255, 50, Projectile.alpha); + return ArcNovaDiffuser.mainColor with { A = 0 }; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.CursedInferno, 900); + } public override void OnKill(int timeLeft) { for (int i = 0; i <= 19; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 107, new Vector2(0, -18).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(0, -18).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.8f, 1.5f); - Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 107, new Vector2(0, -7).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); + dust.scale = Main.rand.NextFloat(0.8f, 2.3f); + dust.color = ArcNovaDiffuser.mainColor; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(0, -7).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f)); dust2.noGravity = false; - dust2.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust2.scale = Main.rand.NextFloat(0.8f, 2.3f); + dust2.color = Color.Lime; } - SoundEngine.PlaySound(ChargeImpact, Projectile.position); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.6f, 20); + SoundEngine.PlaySound(ChargeImpact, Projectile.Center); + Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ArcNovaDiffuser.mainColor, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0, 0.2f, 1.3f, 16); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Chartreuse, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.5f, 16); + Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lime, "CalamityMod/Particles/BloomCircle", new Vector2(1f, 1f), 0, 0.8f, 0.1f, 20); GeneralParticleHandler.SpawnParticle(pulse2); - - for (int i = 0; i < 25; ++i) + for (int i = 0; i < 2; i++) { - int bloodLifetime = Main.rand.Next(22, 36); - float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); - Color bloodColor = Color.Lerp(Color.Lime, Color.Chartreuse, Main.rand.NextFloat()); - bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); - - if (Main.rand.NextBool(20)) - bloodScale *= 2f; - - float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); - Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 5 * randomSpeedMultiplier; - bloodVelocity.Y -= 5f; - BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); - GeneralParticleHandler.SpawnParticle(blood); + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 16, 0.95f, ArcNovaDiffuser.mainColor, new Vector2(1f, 1f), true, true, glowOpacity: 0.9f); + GeneralParticleHandler.SpawnParticle(spark2); } + + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + modifiers.SourceDamage *= 1 + critDamage; } public override bool? CanDamage() => base.CanDamage(); } diff --git a/Projectiles/Ranged/NovaShot.cs b/Projectiles/Ranged/NovaShot.cs index cdddb8ab0e..30189b3350 100644 --- a/Projectiles/Ranged/NovaShot.cs +++ b/Projectiles/Ranged/NovaShot.cs @@ -1,8 +1,9 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +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.Ranged @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Ranged { public bool FirstFrameNoDraw = true; public new string LocalizationCategory => "Projectiles.Ranged"; + public int sineDir = 0; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 8; @@ -33,15 +35,24 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (sineDir == 0) + sineDir = Main.rand.NextBool() ? -1 : 1; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; //Dust dust = Dust.NewDustPerfect(Projectile.Center, 107); // + Main.rand.NextVector2Circular(-3, 3) //dust.noGravity = true; //dust.scale = 0.5f; if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < 290) { - SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 5, 1f, Color.Lime * 0.6f); - GeneralParticleHandler.SpawnParticle(spark); - + Particle Trail = new CustomSpark(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 7, 0.33f, ArcNovaDiffuser.mainColor * 0.8f, new Vector2(0.2f, 1.4f), true, true, shrinkSpeed: 0.4f, glowOpacity: 0.8f); + GeneralParticleHandler.SpawnParticle(Trail); + } + if (Main.rand.NextBool(3)) + { + float sine = (float)Math.Sin(Projectile.timeLeft * 0.45f / MathHelper.Pi); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2 * sineDir) * sine * 8, ModContent.DustType(), Projectile.velocity * Main.rand.NextFloat(0.85f, 0.9f), 0, default, Main.rand.NextFloat(0.4f, 0.45f) * 3); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + dust.fadeIn = Main.rand.NextBool(8) ? -0.4f : 1.75f; } } public override bool PreDraw(ref Color lightColor) @@ -51,11 +62,26 @@ namespace CalamityMod.Projectiles.Ranged } public override Color? GetAlpha(Color lightColor) { - return new Color(50, 255, 50, Projectile.alpha); + return ArcNovaDiffuser.mainColor with { A = 0 }; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.CursedInferno, 90); + if (Projectile.numHits == 0) + { + for (int i = 0; i <= 4; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(7f, 9f), 0, default, Main.rand.NextFloat(0.8f, 1.8f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Lime : ArcNovaDiffuser.mainColor; + dust.fadeIn = 1.5f; + if (Main.rand.NextBool(3)) + { + dust.scale = Main.rand.NextFloat(0.4f, 0.5f); + dust.fadeIn = -0.85f; + dust.velocity /= 2; + } + } + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Ranged/OntologicalDespoilerBeam.cs b/Projectiles/Ranged/OntologicalDespoilerBeam.cs index decb1d6519..d6447d61d3 100644 --- a/Projectiles/Ranged/OntologicalDespoilerBeam.cs +++ b/Projectiles/Ranged/OntologicalDespoilerBeam.cs @@ -1,17 +1,9 @@ using System; -using System.Collections.Generic; -using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -23,6 +15,8 @@ namespace CalamityMod.Projectiles.Ranged public ref float time => ref Projectile.ai[0]; public Color baseColor = Color.White; public bool fading = false; + public int sineDir = 0; + public float fadeMultiplier = 1; public override void SetDefaults() { Projectile.width = 45; @@ -42,7 +36,8 @@ namespace CalamityMod.Projectiles.Ranged Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); bool inRange = targetDist < 1400; - + if (sineDir == 0) + sineDir = Main.rand.NextBool() ? 1 : -1; Projectile.rotation = Projectile.velocity.ToRotation(); if (time <= 5) Projectile.scale = 0.1f; @@ -53,8 +48,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 0.992f; Projectile.scale *= 0.992f; } - if (time > 11) + if (fading) + fadeMultiplier -= 0.007f; + if (time > 11 && inRange) { + if (fadeMultiplier > 0.01f) + { + for (int i = -1 * sineDir; (sineDir == 1 ? (i <= 1) : (i >= -1)); i += 2 * sineDir) + { + float sine = (float)Math.Sin(Projectile.timeLeft * 0.25f / MathHelper.Pi); + + Particle beam = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 35 * i * fadeMultiplier, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4 * Main.rand.NextFloat(0.6f, 0.8f), "CalamityMod/Particles/Light", false, 45, 0.4f * fadeMultiplier * MathHelper.Lerp(Math.Abs(sine), 0.55f, 0.6f), i == 1 ? Color.White : Color.Black, new Vector2(1f, 1f), i == 1 ? true : false, false, 0, false, false, 0, noShrink: true); + GeneralParticleHandler.SpawnParticle(beam); + } + } + if (Main.rand.NextBool(4) && !fading) { Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), (Main.rand.NextBool() ? ModContent.DustType() : ModContent.DustType()), Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(2.3f, 5.8f)); @@ -111,10 +119,10 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 3; i++) { SoundStyle fire = new("CalamityMod/Sounds/Item/OntologicalDespoilerLargeImpact"); - SoundEngine.PlaySound(fire with { Volume = 0.65f, MaxInstances = 3 }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.65f, MaxInstances = -1}, Projectile.Center); } SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldExplosion"); - SoundEngine.PlaySound(fire2 with { Volume = 1, Pitch = Main.rand.NextFloat(-0.5f, -0.6f) }, Projectile.Center); + SoundEngine.PlaySound(fire2 with { Volume = 1, Pitch = Main.rand.NextFloat(-0.5f, -0.6f), MaxInstances = -1 }, Projectile.Center); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Ranged/OpalChargedStrike.cs b/Projectiles/Ranged/OpalChargedStrike.cs index b4f268199b..705ff23ddf 100644 --- a/Projectiles/Ranged/OpalChargedStrike.cs +++ b/Projectiles/Ranged/OpalChargedStrike.cs @@ -1,8 +1,7 @@ -using CalamityMod.Particles; +using CalamityMod.Dusts; +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.Ranged @@ -18,15 +17,15 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = Projectile.height = 30; + Projectile.width = Projectile.height = 35; Projectile.friendly = true; Projectile.alpha = 55; - Projectile.penetrate = 3; + Projectile.penetrate = 5; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 3; + Projectile.extraUpdates = 6; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 50; + Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = false; // Custom tile collision since the hitbox is large } @@ -37,43 +36,49 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(3)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(7, 7), 162); - dust.scale = 1.3f; - dust.velocity = -Projectile.velocity * 0.4f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 0.4f, 0, default, Main.rand.NextFloat(0.75f, 0.95f)); + dust.noGravity = !Main.rand.NextBool(5); + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = -0.85f; } Player Owner = Main.player[Projectile.owner]; float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); - if (Projectile.timeLeft % 2 == 0 && playerDist < 1400f && Projectile.timeLeft < 290) + if (Main.rand.NextBool(3) && playerDist < 1400f && Projectile.timeLeft < 290) { - SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3f, -Projectile.velocity * 0.05f, false, 9, 2f, Color.OrangeRed * 0.25f); - GeneralParticleHandler.SpawnParticle(spark); + Vector2 trailPos = Projectile.Center + Main.rand.NextVector2Circular(8, 8); + float trailScale = Main.rand.NextFloat(0.45f, 0.6f); + Color trailColor = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + Particle Trail = new CustomSpark(trailPos, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 40, trailScale, trailColor, new Vector2(0.2f, 1.4f), true, true, shrinkSpeed: 0.13f, glowOpacity: 0.6f); + GeneralParticleHandler.SpawnParticle(Trail); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.OrangeRed with { A = 0 }, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 120); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.80f); + Projectile.damage = (int)(Projectile.damage * 0.75f); if (Projectile.damage < 1) Projectile.damage = 1; } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 8; i++) + for (int i = 0; i <= 12; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.position, 162, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) / 2, 0, default, Main.rand.NextFloat(1.6f, 2.3f)); - dust.noGravity = false; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.8f, 1.8f), 0, default, Main.rand.NextFloat(1.9f, 2.8f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = 1.85f; } } public override bool? CanDamage() => base.CanDamage(); diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index 2799d09ce6..c7ec142426 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -1,7 +1,6 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -26,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 50; + Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = false; // Custom tile collision since the hitbox is large } @@ -36,12 +35,19 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Kill(); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Dust.NewDustPerfect(Projectile.Center, 162); + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 0.4f, 0, default, Main.rand.NextFloat(0.6f, 0.8f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = -0.5f; + } + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Orange with { A = 0 }, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -52,8 +58,10 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i <= 8; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.position, 162, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) / 2, 0, default, Main.rand.NextFloat(1.6f, 2.3f)); - dust.noGravity = false; + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.6f, 1.3f), 0, default, Main.rand.NextFloat(1.6f, 2.3f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = 1.5f; } } public override bool? CanDamage() => base.CanDamage(); diff --git a/Projectiles/Ranged/OpalStrikerHoldout.cs b/Projectiles/Ranged/OpalStrikerHoldout.cs index 7a42eabdbf..8cbfa0dacd 100644 --- a/Projectiles/Ranged/OpalStrikerHoldout.cs +++ b/Projectiles/Ranged/OpalStrikerHoldout.cs @@ -1,8 +1,11 @@ -using CalamityMod.Items.Weapons.Ranged; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; @@ -14,7 +17,7 @@ namespace CalamityMod.Projectiles.Ranged public class OpalStrikerHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); - public override float MaxOffsetLengthFromArm => 15f; + public override float MaxOffsetLengthFromArm => 25f; public override float OffsetXUpwards => -5f; public override float BaseOffsetY => -5f; @@ -24,6 +27,7 @@ namespace CalamityMod.Projectiles.Ranged public static float ChargedDamageMult = 5f; public static float ChargedKBMult = 3f; public static float BulletSpeed = 12f; + public int time = 0; public override void KillHoldoutLogic() { @@ -52,15 +56,40 @@ namespace CalamityMod.Projectiles.Ranged if (FullyCharged) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * ChargedDamageMult), Projectile.knockBack * ChargedKBMult, Projectile.owner); - for (int i = 0; i <= 10; i++) + for (int i = 0; i <= 35; i++) { - Dust dust = Dust.NewDustPerfect(GunTipPosition, 162, shootVelocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.8f, 1.4f), 0, default, Main.rand.NextFloat(1.5f, 2.3f)); + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(1.6f, 2.9f), 0, default, Main.rand.NextFloat(1.6f, 2.5f)); dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = 2.5f; + if (Main.rand.NextBool(4)) + { + dust.scale = Main.rand.NextFloat(0.8f, 0.95f); + dust.fadeIn = -0.85f; + dust.velocity /= 2; + } + } + OffsetLengthFromArm -= 25f; + Owner.Calamity().GeneralScreenShakePower = 5f; + + for (int i = 0; i < 2; i++) + { + Particle spark2 = new CustomSpark(GunTipPosition, Projectile.velocity * 18, "CalamityMod/Particles/BloomCircle", false, 18, 0.65f, Color.OrangeRed, new Vector2(1.2f, 0.8f), true, true, glowOpacity: 0.9f, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(spark2); } } else + { + for (int i = 0; i <= 5; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVelocity.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.6f, 1.9f), 0, default, Main.rand.NextFloat(1.2f, 2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + dust.fadeIn = 1.5f; + } + OffsetLengthFromArm -= 5f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - + } Projectile.ai[1] = 1f; } } @@ -80,31 +109,27 @@ namespace CalamityMod.Projectiles.Ranged // Charge-up visuals if (CurrentChargingFrames >= 10) { - if (!FullyCharged) - { - Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.06f + (CurrentChargingFrames / 180), 0.08f + (CurrentChargingFrames / 180)), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(0.3f * CurrentChargingFrames, 0.3f * CurrentChargingFrames), 0f, Color.Gold, Color.Orange, 7, GunTipPosition); - GeneralParticleHandler.SpawnParticle(streak); - } - - float orbScale = MathHelper.Clamp(CurrentChargingFrames, 0f, OpalStriker.FullChargeFrames); - Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Color.OrangeRed, orbScale / 135f, 2); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GenericBloom(GunTipPosition, Projectile.velocity, Color.Coral, orbScale / 200f, 2); - GeneralParticleHandler.SpawnParticle(orb2); + float orbScale = MathHelper.Clamp(CurrentChargingFrames, 0f, OpalStriker.FullChargeFrames) / 200; + Lighting.AddLight(GunTipPosition, Color.Orange.ToVector3() * orbScale); } // Full charge dusts if (CurrentChargingFrames == OpalStriker.FullChargeFrames) { + SoundEngine.PlaySound(OpalStriker.Fire with { Pitch = 0.6f, Volume = 0.7f }, Projectile.Center); for (int i = 0; i < 36; i++) { - Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 162); - chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 13f + Owner.velocity; - chargefull.scale = Main.rand.NextFloat(2f, 2.5f); + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType()); + chargefull.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * Main.rand.NextFloat(7, 8.5f); + chargefull.scale = Main.rand.NextFloat(1f, 1.5f); chargefull.noGravity = true; + chargefull.color = Main.rand.NextBool(3) ? Color.Orange : Color.OrangeRed; + chargefull.fadeIn = 1; } + } } + time++; } public override void OnKill(int timeLeft) @@ -115,11 +140,14 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { + if (time < 2) + return false; Texture2D texture = TextureAssets.Projectile[Type].Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); Vector2 rotationPoint = texture.Size() * 0.5f; SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + float chargeScale = KeepRefreshingLifetime ? Utils.GetLerpValue(0, OpalStriker.FullChargeFrames, CurrentChargingFrames, true) : 0; if (!Owner.CantUseHoldout()) { @@ -127,8 +155,22 @@ namespace CalamityMod.Projectiles.Ranged drawPosition += Main.rand.NextVector2Circular(rumble / 30f, rumble / 30f); } + float sine = (float)Math.Sin(time * 0.25f / MathHelper.Pi); + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * (3f + sine * 0.3f); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset * chargeScale, null, Color.OrangeRed with { A = 0 } * Math.Min(chargeScale, 1) * 0.4f, drawRotation, rotationPoint, Projectile.scale, flipSprite, 0); + } + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2.Value, GunTipPosition - Main.screenPosition, null, Color.Lerp(FullyCharged ? Color.OrangeRed : Color.Orange, Color.White, i * 0.25f) with { A = 0 } * 0.8f, Main.rand.NextFloat(-5, 5), tex2.Size() * 0.5f, new Vector2(1.35f, 1f) * Projectile.scale * chargeScale * (1 - 0.27f * i) * 0.3f * ((chargeScale >= 1 && CurrentChargingFrames <= OpalStriker.FullChargeFrames + 3) ? 1.75f : FullyCharged ? 1.4f : 1), SpriteEffects.None, 0); + return false; } } diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs deleted file mode 100644 index af1049f2ba..0000000000 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ /dev/null @@ -1,114 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class PlasmaBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.alpha = 150; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.ignoreWater = true; - } - - public override void AI() - { - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 12f) - { - Projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 dustVel = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - dustVel += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); - dustVel = dustVel.RotatedBy((double)(Projectile.rotation - MathHelper.PiOver2), default); - int dust = Dust.NewDust(Projectile.Center, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 160, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position = Projectile.Center + dustVel; - Main.dust[dust].velocity = Projectile.velocity * 0.1f; - Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[dust].position) * 1.25f; - } - } - - Projectile.alpha -= 15; - int alphaControl = 150; - if (Projectile.Center.Y >= Projectile.ai[1]) - alphaControl = 0; - if (Projectile.alpha < alphaControl) - Projectile.alpha = alphaControl; - - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - - if (Main.rand.NextBool(16)) - { - Vector2 extraDustVel = Vector2.UnitX.RotatedByRandom(MathHelper.PiOver2).RotatedBy((double)Projectile.velocity.ToRotation(), default); - int extraDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FireworkFountain_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - Main.dust[extraDust].velocity = extraDustVel * 0.66f; - Main.dust[extraDust].position = Projectile.Center + extraDustVel * 12f; - } - - if (Main.rand.NextBool(48) && !Main.dedServ) - { - int gore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); - Main.gore[gore].velocity *= 0.66f; - Main.gore[gore].velocity += Projectile.velocity * 0.3f; - } - - if (Projectile.ai[1] == 1f) - { - Projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FireworkFountain_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - if (Main.rand.NextBool(20) && !Main.dedServ) - Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } - - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.1f / 255f, (255 - Projectile.alpha) * 0.7f / 255f, (255 - Projectile.alpha) * 0.15f / 255f); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnKill(int timeLeft) - { - if (Projectile.ai[0] == 1f) - return; - - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - } - } -} diff --git a/Projectiles/Ranged/PlasmaBlast.png b/Projectiles/Ranged/PlasmaBlast.png deleted file mode 100644 index cafdce830a..0000000000 Binary files a/Projectiles/Ranged/PlasmaBlast.png and /dev/null differ diff --git a/Projectiles/Ranged/StarfleetHoldout.cs b/Projectiles/Ranged/StarfleetHoldout.cs new file mode 100644 index 0000000000..a71a81866c --- /dev/null +++ b/Projectiles/Ranged/StarfleetHoldout.cs @@ -0,0 +1,305 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarfleetHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * -5; + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 25f; + public override float OffsetXUpwards => -12f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 10f; + public override float WeaponTurnSpeed => (0.6f); + + public int time = 0; + public int lastUseTime = 0; + public int perfectLeniancy = 2; + public int goodLeniancy => perfectLeniancy + 6; + public ref float shootingCooldown => ref Projectile.ai[0]; + public ref float starburstTimer => ref Projectile.ai[1]; + public int extendedCooldown => (int)(lastUseTime * 1.2f); + public int naildriverCooldown => (int)(lastUseTime * 1.5f); + public int starburstPerfectTime = 23; + public float recoilIntensity = 0; + public int recoilTimerMax = 62; + public Vector2 recoilDirection; + public bool setVel = true; + public float glowIntensity = 1; + public Color c1 = new Color(146, 255, 211); + public Color c2 = new Color(222, 225, 146); + public Color c3 = new Color(255, 233, 146); + public Color shiftColor; + public ref float starburstCooldown => ref Projectile.ai[2]; + public bool naildriver => ((starburstTimer <= starburstPerfectTime + perfectLeniancy) && (starburstTimer >= starburstPerfectTime - perfectLeniancy)); // if within perfect frame window + public bool scattershot => !naildriver && ((starburstTimer <= starburstPerfectTime + goodLeniancy) && (starburstTimer >= starburstPerfectTime - goodLeniancy)); // If within early or late frame window + public override void KillHoldoutLogic() { } + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + } + public override void HoldoutAI() + { + float rate = (time * 0.05f); + List eColors = new List() + { + c1, + c2, + c3, + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + shiftColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + + SetUsage = false; + bool doingNothing = shootingCooldown == 0 && starburstCooldown == 0 && starburstTimer == 0; + if (lastUseTime == 0 || doingNothing) + lastUseTime = Owner.HeldItem.useAnimation; + if (!doingNothing) + Owner.itemTime = Owner.itemAnimation = 5; + + glowIntensity = MathHelper.Lerp(glowIntensity, (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax, 0, shootingCooldown, true), 5), 0.2f); + + if ((Owner.HeldItem.type != ItemType() && doingNothing) || Owner.dead) + { + Projectile.Kill(); + return; + } + bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); + bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; + bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + + if (Main.mouseLeft && !hasAmmo && OffsetLengthFromArm >= 24.5f) + { + OffsetLengthFromArm -= 8; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Volume = .6f, Pitch = -.2f }, Projectile.Center); + } + if (leftShootChecks) + FireShotgun(); + if (rightShootChecks) + { + SoundStyle test = new("CalamityMod/Sounds/Item/StarfleetStarburst"); + SoundEngine.PlaySound(test with { Volume = 1f, Pitch = 0f }, Projectile.Center); + starburstTimer++; + } + if (starburstTimer > 0) + { + // Do wind up animation + if (starburstTimer < starburstPerfectTime / 2) + OffsetLengthFromArm = 25 - 12 * (1 - (float)Math.Pow(Utils.GetLerpValue(starburstPerfectTime / 2 - 1, 0, starburstTimer, true), 5)); + else + OffsetLengthFromArm = 13 + 20 * ((float)Math.Pow(Utils.GetLerpValue(starburstPerfectTime / 2, starburstPerfectTime - 1, starburstTimer, true), 8)); + + if (starburstTimer == starburstPerfectTime) + FireStarburst(); + + starburstTimer++; + if (starburstTimer > starburstPerfectTime + goodLeniancy + 1) + starburstTimer = 0; + } + if (shootingCooldown > 0) + shootingCooldown--; + if (starburstCooldown > 0) + starburstCooldown--; + if (recoilIntensity > 0 && (shootingCooldown > 0 || starburstCooldown > 0)) + ManageRecoil(); + time++; + } + public void ManageRecoil() + { + float slowdown = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); + Vector2 movement = recoilDirection * (recoilIntensity) * slowdown; + if (Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) + { + recoilIntensity = 0; + return; + } + if (slowdown > 0.1f) + { + if (setVel) + { + Owner.velocity = movement * 0.25f; + setVel = false; + } + Projectile.Center += movement; + Owner.Center += movement; + } + else + setVel = true; + } + public void FireShotgun() + { + // 50% chance to not consume ammo + Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool()); + + SoundStyle shotgunFire = new("CalamityMod/Sounds/Item/StarfleetFire"); + for (int i = 0; i < (naildriver ? 2 : 1); i++) + SoundEngine.PlaySound(shotgunFire with { Volume = (naildriver && i == 0 ? 0.3f : 0.6f), Pitch = ((naildriver && i == 0) ? 0f : 0.2f), MaxInstances = 2 }, Projectile.Center); + // Perfects have longer cooldown + int cooldown = (naildriver ? naildriverCooldown : lastUseTime); + recoilTimerMax = cooldown; + shootingCooldown = cooldown; + recoilDirection = -Projectile.velocity; + Owner.Calamity().GeneralScreenShakePower = (naildriver ? 9 : scattershot ? 7 : 4); + OffsetLengthFromArm = (naildriver ? 0 : scattershot ? 7 : 15); + + int baseShotCount = 6; + for (int i = 0; i < baseShotCount; i++) + { + float randomVel = Main.rand.NextFloat(0.8f, 1f); + float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount; + float spread = (naildriver ? 0.06f : scattershot ? 0.9f : 0.25f); + Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1)); + shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + } + for (int i = 0; i < 25; i++) + { + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(GunTipPosition, dustStyle); + dust.scale = (Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance)) * 3f; + dust.velocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(18f, 19f) * (float)Math.Pow(1 - Math.Abs(variance), 2); + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 4.75f; + } + + // You can uncomment this to check your timing + /*if (naildriver) + Main.NewText("naildriver: " + (starburstPerfectTime - starburstTimer), Color.DarkOrchid); + if (scattershot) + Main.NewText("scattershot: " + (starburstPerfectTime - starburstTimer), Color.Lime);*/ + + recoilIntensity = (naildriver ? 55f : scattershot ? 20f : 0); + } + public void FireStarburst() + { + if (Owner.Calamity().GeneralScreenShakePower < 7) + Owner.Calamity().GeneralScreenShakePower = 7; + recoilDirection = -Projectile.velocity; + if (recoilIntensity < 15) + recoilIntensity = 15; + if (recoilTimerMax < extendedCooldown) + recoilTimerMax = extendedCooldown; + if (starburstCooldown < extendedCooldown) + starburstCooldown = extendedCooldown; + + float blastSize = 140; + float minMultiplier = 0.1f; + int hitsToMinMult = 6; + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 3), -45, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 15; + + for (int i = 0; i < 14; i++) + { + float dist = Main.rand.NextFloat(0, 3); + Particle forwardJet = new CustomSpark(GunTipPosition + Main.rand.NextVector2CircularEdge(dist * 5, dist * 5), Projectile.velocity * Main.rand.NextFloat(4, 5) * (6 - dist * 2), "CalamityMod/Particles/ForwardSmear", false, (int)(Main.rand.Next(9, 15 + 1) + (dist * 3)), Main.rand.NextFloat(0.1f, 0.2f), GetRandomColor(), new Vector2(1f, 1f), shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(forwardJet); + } + for (int i = 0; i < 34; i++) + { + float rot = Main.rand.NextFloat(0.05f, 0.35f) * (Main.rand.NextBool() ? -1 : 1); + Vector2 startVel = Projectile.velocity.RotatedBy(rot) * Main.rand.NextFloat(8, 18) * (Main.rand.NextBool(4) ? 2f : 1); + Particle stars = new VelChangingSpark(GunTipPosition, startVel, startVel.RotatedBy(rot * 5), "CalamityMod/Particles/PulseStar", Main.rand.Next(25, 45 + 1), Main.rand.NextFloat(0.1f, 0.35f), GetRandomColor(), new Vector2(1f, 1f), shrinkSpeed: Main.rand.NextFloat(0.02f, 0.06f), lerpRate: 0.02f, glowCenter: true); + GeneralParticleHandler.SpawnParticle(stars); + } + int parts = 60; + for (int i = 0; i < parts; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / parts).ToRotationVector2() * 4f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxVelEnd = new Vector2(intenededVel.X * 0.5f, intenededVel.Y * 6f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxPlace = GunTipPosition + fxVel.RotatedBy(Projectile.velocity.ToRotation()); + + float size = Utils.GetLerpValue(0, -4, intenededVel.X, true); + float width = Utils.GetLerpValue(0, 4 * Math.Sign(fxVel.X), fxVel.X, true); + Color clr = (size <= 0.5f ? Color.Lerp(c3, c2, size * 2) : Color.Lerp(c2, c1, size * 2 - 1f)); + + Particle aura = new CustomSpark(fxPlace, fxVel * 1.2f, "CalamityMod/Particles/BloomCircle", false, (int)(15 + size * 5), 0.35f + size * 0.2f, clr * 0.7f, new Vector2(1f + width * size, 1f), glowCenter: true, glowOpacity: size * 0.85f, glowCenterScale: 0.75f); + GeneralParticleHandler.SpawnParticle(aura); + + } + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => c1, + 1 => c2, + _ => c3, + }; + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D glowTexture = Request("CalamityMod/Items/Weapons/Ranged/StarfleetGlow").Value; + Texture2D orb = Request("CalamityMod/Particles/BloomCircle").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float glowMult = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); + int draws = 18; + float sine = (float)Math.Sin(time * 0.02f); + float attackMult = (float)Math.Pow(Utils.GetLerpValue(0, starburstPerfectTime - 1, starburstTimer, true), 2); + float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 55.5f / MathHelper.Pi); + float fastSine = (float)Math.Sin(time * 0.2f); + Color glowColor = shiftColor; + + if (starburstTimer > 0 && starburstCooldown == 0) + { + for (int i = 0; i < draws; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / draws).ToRotationVector2().RotatedBy(time * 2); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset * 6 * attackMult, null, shiftColor with { A = 0 } * 0.7f * attackMult, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + } + } + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + for (int i = 0; i < draws; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / draws).ToRotationVector2().RotatedBy(time / 5) * (1.25f + (fastSine + 2f) * 0.2f + glowMult * 4); + Main.EntitySpriteDraw(glowTexture, drawPosition + drawOffset, null, Color.Lerp(Color.Gray * 0.15f, glowColor with { A = 0 }, glowIntensity) * (0.1f + 0.5f * glowMult), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(glowTexture, drawPosition, null, Color.Lerp(Color.Gray * 0.15f, Color.White with { A = 0 }, glowIntensity), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + } + + if (starburstTimer > 0 && starburstCooldown == 0) + { + for (int i = 0; i < 6; i++) + { + // The shining orb at the tip + Color orbColor = shiftColor with { A = 0 } * 0.5f; + Vector2 scale = new Vector2(Math.Abs(sine2 * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackMult * Main.rand.NextFloat(0.9f, 1.1f) * 8.5f; + Main.EntitySpriteDraw(orb, GunTipPosition - Main.screenPosition, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + } + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/StarfleetStar.cs b/Projectiles/Ranged/StarfleetStar.cs new file mode 100644 index 0000000000..70cba4ee23 --- /dev/null +++ b/Projectiles/Ranged/StarfleetStar.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarfleetStar : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public Color c1 = new Color(146, 255, 211); + public Color c2 = new Color(222, 225, 146); + public Color c3 = new Color(255, 233, 146); + public Color shiftColor; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.penetrate = 3; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + + public override void AI() + { + float rate = (Projectile.ai[2] * 0.05f); + List eColors = new List() + { + c1, + c2, + c3, + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + shiftColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + Projectile.ai[2]++; + + if (time > 5 && time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 28, Projectile.velocity, "CalamityMod/Particles/DualTrail", false, 15, 0.11f, shiftColor * 0.6f, new Vector2(0.9f, 1.1f), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(trail); + + if (time > 18) + { + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), dustStyle); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(3f, 5f); + dust.noGravity = true; + dust.color = shiftColor; + dust.fadeIn = 5f; + } + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => c1, + 1 => c2, + _ => c3, + }; + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D glowTexture = Request("CalamityMod/Projectiles/Rogue/LeonidStar").Value; + Texture2D tex2 = Request("CalamityMod/Particles/FadeStreak").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = glowTexture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + for (int i = 0; i < 5; i++) + { + Vector2 offset = (MathHelper.TwoPi * i / 5).ToRotationVector2().RotatedBy(Projectile.rotation + MathHelper.Pi); + for (int t = 0; t < 2; t++) + Main.EntitySpriteDraw(tex2, drawPosition, null, shiftColor with { A = 0 } * 0.4f, offset.ToRotation(), new Vector2(tex2.Width * 0.5f, 0), new Vector2((2.3f + t * 0.03f) * (i == 2 ? 1.8f : i == 3 ? 1.8f : 1), (1.1f + t * 0.03f) * (i == 2 ? 0.75f : i == 3 ? 0.75f : 1)) * Projectile.scale * Owner.gravDir * 0.3f, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.White with { A = 0 } * 0.4f, offset.ToRotation(), new Vector2(tex2.Width * 0.5f, 0), new Vector2(1.5f, 0.7f) * Projectile.scale * Owner.gravDir * 0.3f, SpriteEffects.FlipVertically); + } + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.1f; + int hitsToMinMult = 2; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 15; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = (Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance)) * 1.5f; + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(variance) * Main.rand.NextFloat(18f, 19f) * (float)Math.Pow(1 - Math.Abs(variance), 2); + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 2.5f; + } + } + + } +} diff --git a/Projectiles/Ranged/StarmadaBack.png b/Projectiles/Ranged/StarmadaBack.png new file mode 100644 index 0000000000..0ab54481ce Binary files /dev/null and b/Projectiles/Ranged/StarmadaBack.png differ diff --git a/Projectiles/Ranged/StarmadaBackGlow.png b/Projectiles/Ranged/StarmadaBackGlow.png new file mode 100644 index 0000000000..272ee30ca2 Binary files /dev/null and b/Projectiles/Ranged/StarmadaBackGlow.png differ diff --git a/Projectiles/Ranged/StarmadaFront.png b/Projectiles/Ranged/StarmadaFront.png new file mode 100644 index 0000000000..56513025f1 Binary files /dev/null and b/Projectiles/Ranged/StarmadaFront.png differ diff --git a/Projectiles/Ranged/StarmadaFrontGlow.png b/Projectiles/Ranged/StarmadaFrontGlow.png new file mode 100644 index 0000000000..8a230dbe1f Binary files /dev/null and b/Projectiles/Ranged/StarmadaFrontGlow.png differ diff --git a/Projectiles/Ranged/StarmadaHitProj.cs b/Projectiles/Ranged/StarmadaHitProj.cs new file mode 100644 index 0000000000..14e303c9d7 --- /dev/null +++ b/Projectiles/Ranged/StarmadaHitProj.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarmadaHitProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public Color c1 = new Color(164, 47, 160); + public Color c2 = new Color(227, 97, 72); + public Color c3 = new Color(193, 255, 146); + public Color shiftColor; + public bool move = false; + public NPC targeted; + public Vector2 targetPos; + public Vector2 distFromPos; + public float squash = 1; + public bool launched => Projectile.localAI[2] == 5 && move; + public bool setLaunchStats = true; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.timeLeft = 800; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + public void FindTarget() + { + if (Projectile.ai[0] != -5) + targeted = Main.npc[(int)Projectile.ai[0]]; + if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active) + { + targeted = Projectile.Center.ClosestNPCAt(800); + Projectile.ai[0] = -5; + } + } + + public override void AI() + { + if (time == 0) + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + targetPos = Projectile.Center; + } + float rate = (Projectile.ai[2] * 0.05f); + List eColors = new List() + { + c1, + c2, + c3, + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + shiftColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + Projectile.ai[2]++; + + float startTime = 120 + Projectile.ai[1]; + float endTime = startTime + 15 + Projectile.ai[1]; + if (launched) + { + if (setLaunchStats) + { + Projectile.extraUpdates = 12; + Projectile.penetrate = 1; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + setLaunchStats = false; + } + Projectile.rotation += (MathHelper.TwoPi) / (endTime / 3); + if (time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 28, Projectile.velocity, "CalamityMod/Particles/BloomCircle", false, 13, 0.11f, shiftColor * 0.6f, new Vector2(launched ? 5.5f : 0.8f, 3f), shrinkSpeed: launched ? 1f : 0.5f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + else + { + if (move) + { + squash = MathHelper.Lerp(squash, (time < endTime ? 0.15f : 1f), 0.08f); + if (time == endTime) + Projectile.localAI[2] = 1; + if (time >= endTime) + { + if (Main.rand.NextBool(15)) + { + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), dustStyle); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(5f, 7f); + dust.noGravity = true; + dust.color = shiftColor; + dust.fadeIn = 2f; + } + + Projectile.Center += Projectile.velocity.SafeNormalize(Vector2.UnitX) * 0.2f; + if (time < endTime * 2f) + Projectile.velocity *= 0.9f + (Projectile.ai[1] * 0.005f); + + Projectile.rotation += (MathHelper.TwoPi) / (endTime / 3); + } + else + { + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.1f); + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 28, Projectile.velocity, "CalamityMod/Particles/BloomCircle", false, 15, 0.3f, shiftColor, new Vector2(0.8f, 1.3f), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + else + { + Projectile.rotation += MathHelper.TwoPi / (startTime / 3); + + FindTarget(); + if (targeted != null) + { + targetPos = targeted.Center; + } + if (distFromPos != Vector2.Zero) + { + Projectile.Center = targetPos + distFromPos; + } + else if (targeted != null) + distFromPos = (Projectile.Center - targeted.Center); + + + distFromPos += -Projectile.velocity * 3.5f; + Projectile.velocity *= 0.97f + (Projectile.ai[1] * 0.0025f); + } + } + if (time == startTime && setLaunchStats) + { + Projectile.timeLeft = (int)(endTime * 3); + move = true; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15; + } + + Projectile.scale = (float)Math.Pow(Math.Min(Utils.GetLerpValue(0, 40, time, true), Utils.GetLerpValue(0, 40, Projectile.timeLeft, true)), 3); + + time++; + } + public override bool ShouldUpdatePosition() => move; + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => c1, + 1 => c2, + _ => c3, + }; + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D star = Request("CalamityMod/ExtraTextures/SimpleStar").Value; + Texture2D tex = Request("CalamityMod/Particles/CircularSmear").Value; + Texture2D tex2 = Request("CalamityMod/Particles/FadeStreak").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = star.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(tex, drawPosition, null, shiftColor with { A = 0 } * Math.Max((float)Math.Pow(squash, 5) - 0.15f, 0), Projectile.rotation * 1.6f, tex.Size() * 0.5f, Projectile.scale * Owner.gravDir * 0.39f, SpriteEffects.None); + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(star, drawPosition, null, i == 0 ? Color.White with { A = 0 } * 0.3f : (shiftColor with { A = 0 } * 0.6f), Projectile.rotation, rotationPoint, new Vector2(1f * squash, 1f + (1 - squash)) * Projectile.scale * Owner.gravDir * (i == 0 ? 0.12f : 0.2f), SpriteEffects.None); + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + + float minMult = 0.1f; + int hitsToMinMult = 2; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (launched ? 2 : 1); + } + public override void OnKill(int timeLeft) + { + if (launched) + { + float rot = Main.rand.NextFloat(0, MathHelper.TwoPi); + for (int b = 1; b <= 6; b++) + { + for (int i = 0; i < 5; i++) + { + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = 8 - b; + dust.velocity = -Vector2.UnitY.RotatedBy((MathHelper.TwoPi / 5 * i) + rot) * (b * 1.75f + 2); + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 6.5f - b * 0.5f; + } + } + Particle bloom = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 25, 1.2f, shiftColor, new Vector2(1, 1), true, true, 0, false, false, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(bloom); + } + } + + } +} diff --git a/Projectiles/Ranged/StarmadaHoldout.cs b/Projectiles/Ranged/StarmadaHoldout.cs new file mode 100644 index 0000000000..c1ad5ad3c4 --- /dev/null +++ b/Projectiles/Ranged/StarmadaHoldout.cs @@ -0,0 +1,471 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarmadaHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * -5; + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 32f; + public override float OffsetXUpwards => -12f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 10f; + public override float WeaponTurnSpeed => (0.6f); + + public int time = 0; + public int lastUseTime = 0; + public int perfectLeniancy = 2; + public float frontRecoil = 0; + public int goodLeniancy => perfectLeniancy + 6; + public ref float shootingCooldown => ref Projectile.ai[0]; + public ref float starburstTimer => ref Projectile.ai[1]; + public int extendedCooldown => (int)(lastUseTime * 1.2f); + public int perfectCooldown => (int)(lastUseTime * 1.5f); + public int starburstPerfectTime = 23; + public float recoilIntensity = 0; + public int recoilTimerMax = 62; + public Vector2 recoilDirection; + public bool setVel = true; + public float glowIntensity = 1; + public float attackVisualMult = 0; + public Color c1 = new Color(164, 47, 160); + public Color c2 = new Color(227, 97, 72); + public Color c3 = new Color(193, 255, 146); + public Color shiftColor; + public Vector2 gunBackPosition; + public int gunPower = 1; + public int lastGunPower = 1; + public SlotId AudSlot1; + public SlotId AudSlot2; + public bool failedChain = false; + public float shake = 0; + public ref float starburstCooldown => ref Projectile.ai[2]; + public bool naildriver => ((starburstTimer <= starburstPerfectTime + perfectLeniancy) && (starburstTimer >= starburstPerfectTime - perfectLeniancy)); // if within perfect frame window + public bool scattershot => !naildriver && ((starburstTimer <= starburstPerfectTime + goodLeniancy) && (starburstTimer >= starburstPerfectTime - goodLeniancy)); // If within early or late frame window + public override void KillHoldoutLogic() { } + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + } + public override void HoldoutAI() + { + float rate = (time * 0.05f); + List eColors = new List() + { + c1, + c2, + c3, + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + shiftColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + + SetUsage = false; + bool doingNothing = shootingCooldown == 0 && starburstCooldown == 0 && starburstTimer == 0; + if (lastUseTime == 0 || doingNothing) + lastUseTime = Owner.HeldItem.useAnimation; + if (!doingNothing) + Owner.itemTime = Owner.itemAnimation = 5; + + glowIntensity = MathHelper.Lerp(glowIntensity, (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax, 0, shootingCooldown, true), 5), 0.2f); + attackVisualMult = MathHelper.Lerp(attackVisualMult, (float)Math.Pow(Math.Min(Utils.GetLerpValue(0, starburstPerfectTime - 1, starburstTimer, true), 2) + (gunPower - 1) * 0.25f, 1) * glowIntensity, 0.2f); + shake = MathHelper.Lerp(shake, 0, 0.05f); + frontRecoil = MathHelper.Lerp(frontRecoil, 0, 0.11f); + + if ((Owner.HeldItem.type != ItemType() && doingNothing) || Owner.dead) + { + Projectile.Kill(); + return; + } + bool hasAmmo = Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, true); + bool leftShootChecks = (Main.mouseLeft && !Main.mapFullscreen && !Owner.mouseInterface && shootingCooldown == 0) && hasAmmo; + bool rightShootChecks = Owner.Calamity().mouseRight && !Main.mapFullscreen && !Owner.mouseInterface && starburstCooldown == 0 && starburstTimer == 0; + + if (Main.mouseLeft && !hasAmmo && shake < 0.1f) + { + shake = 0.8f; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Volume = .6f, Pitch = -.2f}, Projectile.Center); + } + + if (leftShootChecks) + FireShotgun(); + if (rightShootChecks) + { + SoundStyle blast1 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); + AudSlot1 = SoundEngine.PlaySound(blast1 with { Volume = 0.7f + gunPower * 0.1f, Pitch = 0f, MaxInstances = 8 }, Projectile.Center); + SoundStyle blast2 = new("CalamityMod/Sounds/Item/StarfleetStarburst"); + AudSlot2 = SoundEngine.PlaySound(blast2 with { Volume = 0.5f + gunPower * 0.1f, Pitch = -0.2f + gunPower * 0.2f, MaxInstances = 8 }, Projectile.Center); + lastGunPower = gunPower; + starburstTimer++; + } + if (starburstTimer > 0) + { + // Do wind up animation + if (starburstTimer < starburstPerfectTime / 2) + { + float up = (1 - (float)Math.Pow(Utils.GetLerpValue(starburstPerfectTime / 2 - 1, 0, starburstTimer, true), 2)); + OffsetLengthFromArm = 32 - 7 * up; + frontRecoil = -25 * up; + } + else + { + float down = ((float)Math.Pow(Utils.GetLerpValue(starburstPerfectTime / 2, starburstPerfectTime - 1, starburstTimer, true), 12)); + OffsetLengthFromArm = 25 + 15 * down; + frontRecoil = -25 + 25 * down; + } + + if (starburstTimer == starburstPerfectTime) + FireStarburst(); + + starburstTimer++; + if (starburstTimer > starburstPerfectTime + goodLeniancy + 1) + starburstTimer = 0; + } + if (shootingCooldown > 0) + { + if (lastGunPower != gunPower) + { + if (SoundEngine.TryGetActiveSound(AudSlot1, out var s1) && s1.IsPlaying && failedChain) + { + s1.Pitch = MathHelper.Lerp(s1.Pitch, -0.7f, 0.07f); + s1.Volume = MathHelper.Lerp(s1.Volume, 0.2f, 0.07f); + } + if (SoundEngine.TryGetActiveSound(AudSlot2, out var s2) && s2.IsPlaying && failedChain) + { + s2.Pitch = MathHelper.Lerp(s2.Pitch, -0.7f, 0.07f); + s2.Volume = MathHelper.Lerp(s2.Volume, 0.2f, 0.07f); + } + } + shootingCooldown--; + } + else + failedChain = false; + if (starburstCooldown > 0) + starburstCooldown--; + if (recoilIntensity > 0 && (shootingCooldown > 0 || starburstCooldown > 0)) + ManageRecoil(); + + time++; + } + public void ManageRecoil() + { + float slowdown = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); + Vector2 movement = recoilDirection * (recoilIntensity) * slowdown; + if (Collision.SolidCollision(Owner.Center + movement, (int)(Owner.width * 1.1f), (int)(Owner.height * 1.1f)) || !Owner.Calamity().mouseRight) + { + recoilIntensity = 0; + return; + } + if (slowdown > 0.1f) + { + if (setVel) + { + Owner.velocity = movement * 0.25f; + setVel = false; + } + Projectile.Center += movement; + Owner.Center += movement; + } + else + setVel = true; + } + public void FireShotgun() + { + // 50% chance to not consume ammo + Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.NextBool()); + + + if (!naildriver && gunPower > 1) + { + shake = 4; + failedChain = true; + SoundStyle oops = new("CalamityMod/Sounds/Item/TaserLaunch"); + SoundStyle oops2 = new("CalamityMod/Sounds/Item/LightMetal"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound((i == 0 ? oops : oops2) with { Volume = 1f, Pitch = (i == 0 ? 0.5f : -0.3f), MaxInstances = 2 }, Projectile.Center); + } + else + { + SoundStyle shotgunFire = new("CalamityMod/Sounds/Item/StarmadaFire"); + for (int i = 0; i < (naildriver ? 2 : 1); i++) + SoundEngine.PlaySound(shotgunFire with { Volume = (naildriver && i == 0 ? 0.3f : 0.6f), Pitch = ((naildriver && i == 0) ? -0.2f : 0f), MaxInstances = 2 }, Projectile.Center); + + for (int b = 0; b < 24; b++) + { + int parts2 = 4; + for (int i = 0; i < parts2; i++) + { + float power = Main.rand.NextFloat(0.2f, 1f); + Vector2 vel = (MathHelper.TwoPi * i / parts2).ToRotationVector2().RotatedBy(Projectile.rotation) * 12f; + float size = (0.8f + 0.35f * gunPower) * Main.rand.NextFloat(0.9f, 1.1f) * (1.1f - power); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(gunBackPosition, dustStyle); + dust.scale = size; + dust.velocity = vel * power * (0.7f + gunPower * 0.2f); + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 0f; + + if (b == 0) + { + Particle aura = new CustomSpark(gunBackPosition, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 20, size * 0.9f, shiftColor, new Vector2(0.65f, 1f), glowCenter: true, glowOpacity: 0.8f, glowCenterScale: 0.85f, extraRotation: Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(aura); + } + } + } + } + + // Perfects have longer cooldown + int cooldown = (naildriver ? perfectCooldown : lastUseTime); + recoilTimerMax = cooldown; + shootingCooldown = cooldown; + recoilDirection = -Projectile.velocity; + Owner.Calamity().GeneralScreenShakePower = (naildriver ? 9 + gunPower : scattershot ? 8 : 5); + OffsetLengthFromArm = (naildriver ? 0 : scattershot ? 7 : 15); + frontRecoil = (naildriver ? -25 : scattershot ? -18 : -10); + + float gunPowerMult = MathHelper.Lerp(gunPower, 1, 0.7f); + + int baseShotCount = 7; + for (int i = 0; i < baseShotCount + gunPower; i++) + { + float randomVel = Main.rand.NextFloat(0.8f, 1f); + float damageMult = ((naildriver || scattershot) ? 1.75f : 1f) / baseShotCount; + float spread = (i == 0 ? 0f : naildriver ? 0.06f : scattershot ? 0.9f : 0.25f) * MathHelper.Lerp(gunPower, 1, 0.75f); + Projectile shotgun = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, randomVel * Projectile.velocity.RotatedByRandom(spread) * 8, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner, 0, 0, Main.rand.Next(0, 300 + 1)); + shotgun.extraUpdates = naildriver ? 9 : scattershot ? 7 : 3; + } + for (int i = 0; i < (int)(25 * gunPowerMult); i++) + { + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(GunTipPosition, dustStyle); + dust.scale = (Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance)) * 3f * gunPowerMult; + dust.velocity = Projectile.velocity.RotatedBy(variance) * Main.rand.NextFloat(18f, 19f) * (float)Math.Pow(1 - Math.Abs(variance), 2) * gunPowerMult; + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 3.75f; + } + + // You can uncomment this to check your timing + /*if (naildriver) + Main.NewText("naildriver: " + (starburstPerfectTime - starburstTimer), Color.DarkOrchid); + if (scattershot) + Main.NewText("scattershot: " + (starburstPerfectTime - starburstTimer), Color.Lime);*/ + + if (naildriver && gunPower < 3) + gunPower++; + if (scattershot || (!naildriver && !scattershot)) + gunPower = 1; + + recoilIntensity = (naildriver ? 70f : scattershot ? 25f : 0); + setVel = true; + } + public void FireStarburst() + { + if (Owner.Calamity().GeneralScreenShakePower < 8) + Owner.Calamity().GeneralScreenShakePower = 8; + recoilDirection = -Projectile.velocity; + if (recoilIntensity < 19) + recoilIntensity = 19; + if (recoilTimerMax < extendedCooldown) + recoilTimerMax = extendedCooldown; + if (starburstCooldown < extendedCooldown) + starburstCooldown = extendedCooldown; + setVel = true; + + Vector2 blastCenter = GunTipPosition + Projectile.velocity * 10; + float blastSize = 140 + 15 * lastGunPower; + float minMultiplier = 0.1f; + int hitsToMinMult = 8; + int damage = (int)(Projectile.damage * (1 + lastGunPower * 0.5f)); + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), blastCenter, Vector2.Zero, ModContent.ProjectileType(), damage, -45, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 15; + + float gunPowerMult = MathHelper.Lerp(lastGunPower, 1, 0.7f); + for (int i = 0; i < 20; i++) + { + float dist = Main.rand.NextFloat(1, 4); + Particle forwardJet = new CustomSpark(GunTipPosition + Main.rand.NextVector2CircularEdge(dist * 3.5f, dist * 3.5f), Projectile.velocity * Main.rand.NextFloat(5, 6) * (8 - dist * 2) * gunPowerMult, "CalamityMod/Particles/ForwardSmear", false, (int)(Main.rand.Next(9, 15 + 1) + (dist * 3)), Main.rand.NextFloat(0.15f, 0.25f) * gunPowerMult, GetRandomColor(), new Vector2(1f, 1f), shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(forwardJet); + } + for (int i = 0; i < 34; i++) + { + float rot = Main.rand.NextFloat(0.05f, 0.35f) * (Main.rand.NextBool() ? -1 : 1); + Vector2 startVel = Projectile.velocity.RotatedBy(rot) * Main.rand.NextFloat(8, 18) * (Main.rand.NextBool(4) ? 2f : 1); + Particle stars = new VelChangingSpark(GunTipPosition, startVel * gunPowerMult, startVel.RotatedBy(rot * 5) * gunPowerMult, "CalamityMod/Particles/PulseStar", Main.rand.Next(25, 45 + 1), Main.rand.NextFloat(0.1f, 0.35f) * gunPowerMult, GetRandomColor(), new Vector2(1f, 1f), shrinkSpeed: Main.rand.NextFloat(0.02f, 0.06f), lerpRate: 0.02f, glowCenter: true); + GeneralParticleHandler.SpawnParticle(stars); + } + if (lastGunPower == 3) + { + int parts2 = 45; + for (int i = 0; i < parts2; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / parts2).ToRotationVector2() * 3f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxVelEnd = new Vector2(intenededVel.X * 0.5f, intenededVel.Y * 6f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxPlace = GunTipPosition + Projectile.velocity * 45 + fxVel.RotatedBy(Projectile.velocity.ToRotation()); + + float size = Utils.GetLerpValue(0, -3, intenededVel.X, true); + float width = Utils.GetLerpValue(0, 3 * Math.Sign(fxVel.X), fxVel.X, true); + Color clr = (size <= 0.5f ? Color.Lerp(c3, c2, size * 2) : Color.Lerp(c2, c1, size * 2 - 1f)); + + Particle aura = new CustomSpark(fxPlace, fxVel * 1.2f, "CalamityMod/Particles/BloomCircle", false, (int)(15 + size * 5), 0.35f + size * 0.2f, clr * 0.7f, new Vector2(1f + width * size, 1f), glowCenter: true, glowOpacity: size * 0.85f, glowCenterScale: 0.75f); + GeneralParticleHandler.SpawnParticle(aura); + + } + } + if (lastGunPower >= 2) + { + int parts = 85; + for (int i = 0; i < parts; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / parts).ToRotationVector2() * 5f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxVelEnd = new Vector2(intenededVel.X * 0.5f, intenededVel.Y * 6f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxPlace = GunTipPosition + fxVel.RotatedBy(Projectile.velocity.ToRotation()); + + float size = Utils.GetLerpValue(0, -5, intenededVel.X, true); + float width = Utils.GetLerpValue(0, 5 * Math.Sign(fxVel.X), fxVel.X, true); + Color clr = (size <= 0.5f ? Color.Lerp(c3, c2, size * 2) : Color.Lerp(c2, c1, size * 2 - 1f)); + + Particle aura = new CustomSpark(fxPlace, fxVel * 1.2f, "CalamityMod/Particles/BloomCircle", false, (int)(19 + size * 6), 0.45f + size * 0.23f, clr * 0.7f, new Vector2(1f + width * size, 1f), glowCenter: true, glowOpacity: size * 0.85f, glowCenterScale: 0.75f); + GeneralParticleHandler.SpawnParticle(aura); + + } + } + else + { + int parts = 70; + for (int i = 0; i < parts; i++) + { + Vector2 intenededVel = (MathHelper.TwoPi * i / parts).ToRotationVector2() * 4f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxVelEnd = new Vector2(intenededVel.X * 0.5f, intenededVel.Y * 6f).RotatedBy(Projectile.velocity.ToRotation()); + Vector2 fxPlace = GunTipPosition + fxVel.RotatedBy(Projectile.velocity.ToRotation()); + + float size = Utils.GetLerpValue(0, -4, intenededVel.X, true); + float width = Utils.GetLerpValue(0, 4 * Math.Sign(fxVel.X), fxVel.X, true); + Color clr = (size <= 0.5f ? Color.Lerp(c3, c2, size * 2) : Color.Lerp(c2, c1, size * 2 - 1f)); + + Particle aura = new CustomSpark(fxPlace, fxVel * 1.2f, "CalamityMod/Particles/BloomCircle", false, (int)(18 + size * 5), 0.35f + size * 0.23f, clr * 0.7f, new Vector2(1f + width * size, 1f), glowCenter: true, glowOpacity: size * 0.85f, glowCenterScale: 0.75f); + GeneralParticleHandler.SpawnParticle(aura); + + } + } + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => c1, + 1 => c2, + _ => c3, + }; + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + gunBackPosition = Projectile.Center - Projectile.velocity * 38f + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * -2; + + Texture2D orb = Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D shine = Request("CalamityMod/Particles/FadeStreak").Value; + + Texture2D front = Request("CalamityMod/Projectiles/Ranged/StarmadaFront").Value; + Texture2D frontGlow = Request("CalamityMod/Projectiles/Ranged/StarmadaFrontGlow").Value; + Texture2D back = Request("CalamityMod/Projectiles/Ranged/StarmadaBack").Value; + Texture2D backGlow = Request("CalamityMod/Projectiles/Ranged/StarmadaBackGlow").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Main.rand.NextVector2Circular(8 * shake, 8 * shake); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float glowMult = (float)Math.Pow(Utils.GetLerpValue(recoilTimerMax / 2, recoilTimerMax, Math.Max(shootingCooldown, starburstCooldown), true), 4); + int draws = 14 + 4 * gunPower; + float sine = (float)Math.Sin(time * 0.02f); + float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 55.5f / MathHelper.Pi); + float fastSine = (float)Math.Sin(time * 0.2f); + Color glowColor = Color.Lerp(Color.Gray * 0.15f, shiftColor with { A = 0 }, glowIntensity) * (0.1f * gunPower + 0.5f * glowMult); + Vector2 frontRecoilPlace = Projectile.velocity * frontRecoil; + + if ((starburstTimer > 0 && starburstCooldown == 0) || gunPower > 1) + { + for (int i = 0; i < draws; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / draws).ToRotationVector2().RotatedBy(time * 2); + Main.EntitySpriteDraw(back, drawPosition + drawOffset * (6 + gunPower) * attackVisualMult, null, shiftColor with { A = 0 } * 0.7f * attackVisualMult, drawRotation, back.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(front, drawPosition + drawOffset * (6 + gunPower) * attackVisualMult + frontRecoilPlace, null, shiftColor with { A = 0 } * 0.7f * attackVisualMult, drawRotation, front.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + } + } + + // back + Main.EntitySpriteDraw(back, drawPosition, null, drawColor, drawRotation, back.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + for (int i = 0; i < draws; i++) // back glow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / draws).ToRotationVector2().RotatedBy(time / 5) * (1.25f + (fastSine + 2f) * 0.2f + glowMult * 4) * MathHelper.Lerp(gunPower, 1, 0.75f); + Main.EntitySpriteDraw(backGlow, drawPosition + drawOffset, null, glowColor, drawRotation, backGlow.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(backGlow, drawPosition, null, Color.Lerp(Color.Gray * 0.15f, Color.White with { A = 0 }, glowIntensity), drawRotation, backGlow.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + } + // front + Main.EntitySpriteDraw(front, drawPosition + frontRecoilPlace, null, drawColor, drawRotation, front.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + for (int i = 0; i < draws; i++) // front glow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / draws).ToRotationVector2().RotatedBy(time / 5) * (1.25f + (fastSine + 2f) * 0.2f + glowMult * 4) * MathHelper.Lerp(gunPower, 1, 0.75f); + Main.EntitySpriteDraw(frontGlow, drawPosition + drawOffset + frontRecoilPlace, null, glowColor, drawRotation, frontGlow.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + Main.EntitySpriteDraw(frontGlow, drawPosition + frontRecoilPlace, null, Color.Lerp(Color.Gray * 0.15f, Color.White with { A = 0 }, glowIntensity), drawRotation, frontGlow.Size() * 0.5f, Projectile.scale * Owner.gravDir, flipSprite); + } + + if (starburstTimer > 0 && starburstCooldown == 0) + { + for (int i = 0; i < 6; i++) + { + // The shining orb at the tip + Color orbColor = shiftColor with { A = 0 } * 0.5f; + Vector2 scale = new Vector2(Math.Abs(sine2 * 0.5f) + 0.1f, 1) * (0.05f + i * 0.01f) * attackVisualMult * Main.rand.NextFloat(0.9f, 1.1f) * 8.5f; + Main.EntitySpriteDraw(orb, GunTipPosition - Main.screenPosition, null, orbColor, Main.rand.NextFloat(-5, 5), orb.Size() * 0.5f, scale, SpriteEffects.None); + } + } + + Color powerColor = Color.Lerp(shiftColor, (gunPower == 1 ? c1 : gunPower == 2 ? c2 : c3), 0.7f); + + float scaleMod = (0.15f + gunPower * 0.1f) * attackVisualMult; + float rand = Main.rand.NextFloat(0.7f, 1f); + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(orb, gunBackPosition - Main.screenPosition, null, powerColor with { A = 0 }, y == 0 ? MathHelper.PiOver2 : 0, orb.Size() * 0.5f, new Vector2(0.5f, 1f) * scaleMod * 0.6f * rand, SpriteEffects.None); + + Vector2 offset = (MathHelper.TwoPi * i / 4).ToRotationVector2().RotatedBy(Projectile.rotation); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(shine, gunBackPosition - Main.screenPosition, null, powerColor with { A = 0 }, offset.ToRotation(), new Vector2(shine.Width * 0.5f, 0), new Vector2((1f - t * 0.1f) * rand + gunPower * 0.05f, 0.5f + t * 0.15f) * Projectile.scale * Owner.gravDir * scaleMod, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(shine, gunBackPosition - Main.screenPosition, null, Color.White with { A = 0 }, offset.ToRotation(), new Vector2(shine.Width * 0.5f, 0), new Vector2(0.5f, 0.75f) * Projectile.scale * Owner.gravDir * scaleMod, SpriteEffects.FlipVertically); + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/StarmadaStar.cs b/Projectiles/Ranged/StarmadaStar.cs new file mode 100644 index 0000000000..2d670a4280 --- /dev/null +++ b/Projectiles/Ranged/StarmadaStar.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarmadaStar : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public Color c1 = new Color(164, 47, 160); + public Color c2 = new Color(227, 97, 72); + public Color c3 = new Color(193, 255, 146); + public Color shiftColor; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 25; + Projectile.height = 25; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.penetrate = 5; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + } + + public override void AI() + { + float rate = (Projectile.ai[2] * 0.05f); + List eColors = new List() + { + c1, + c2, + c3, + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + shiftColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + Projectile.ai[2]++; + + if (time > 5 && time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 28, Projectile.velocity, "CalamityMod/Particles/DualTrail", false, 15, 0.11f, shiftColor, new Vector2(0.9f, 1.1f), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(trail); + + if (time > 18) + { + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), dustStyle); + dust.scale = Main.rand.NextFloat(1.2f, 1.8f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(3f, 5f); + dust.noGravity = true; + dust.color = shiftColor; + dust.fadeIn = 5f; + } + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + time++; + } + public Color GetRandomColor() + { + Color useColor = Main.rand.Next(4) switch + { + 0 => c1, + 1 => c2, + _ => c3, + }; + return useColor; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex2 = Request("CalamityMod/Particles/FadeStreak").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + for (int i = 0; i < 5; i++) + { + Vector2 offset = (MathHelper.TwoPi * i / 5).ToRotationVector2().RotatedBy(Projectile.rotation + MathHelper.Pi); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(tex2, drawPosition, null, shiftColor with { A = 0 }, offset.ToRotation(), new Vector2(tex2.Width * 0.5f, 0), new Vector2((2.3f + t * 0.03f) * (i == 2 ? 1.8f : i == 3 ? 1.8f : 1), (1.1f + t * 0.03f) * (i == 2 ? 0.75f : i == 3 ? 0.75f : 1)) * Projectile.scale * Owner.gravDir * 0.3f, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.White with { A = 0 }, offset.ToRotation(), new Vector2(tex2.Width * 0.5f, 0), new Vector2(1.5f, 0.7f) * Projectile.scale * Owner.gravDir * 0.3f, SpriteEffects.FlipVertically); + } + return false; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.1f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (Projectile.numHits == 0 && false) + { + // spawn slice projectiles + Vector2 spawnPos = target.Center + target.Center.DirectionFrom(Owner.Center).RotatedByRandom(0.5f) * (target.height / 2 + 40); + Vector2 vel = spawnPos.DirectionTo(target.Center); + int damage = (int)(Projectile.damage * 0.25f); + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnPos, vel, ModContent.ProjectileType(), damage, 0, Projectile.owner, target.whoAmI, Main.rand.Next(0, 7 + 1), Main.rand.Next(0, 300 + 1)); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 15; i++) + { + float variance = Main.rand.NextFloat(-0.5f, 0.5f); + int dustStyle = DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = (Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance)) * 1.5f; + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(variance) * Main.rand.NextFloat(18f, 19f) * (float)Math.Pow(1 - Math.Abs(variance), 2); + dust.noGravity = true; + dust.color = GetRandomColor(); + dust.fadeIn = 2.5f; + } + } + + } +} diff --git a/Projectiles/Ranged/StarmageddonStar.cs b/Projectiles/Ranged/StarmageddonStar.cs index 207cf9d1f4..335c06808d 100644 --- a/Projectiles/Ranged/StarmageddonStar.cs +++ b/Projectiles/Ranged/StarmageddonStar.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Ranged int type = Utils.SelectRandom(Main.rand, [ - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Ranged int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, predictSpeed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { - if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) + if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; Main.projectile[star].extraUpdates = 4; diff --git a/Projectiles/Ranged/StarmageddonStar2.cs b/Projectiles/Ranged/StarmageddonStar2.cs index be24aa193a..0c5a80e8d2 100644 --- a/Projectiles/Ranged/StarmageddonStar2.cs +++ b/Projectiles/Ranged/StarmageddonStar2.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Ranged int type = Utils.SelectRandom(Main.rand, [ - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Ranged int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, predictSpeed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { - if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) + if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; Main.projectile[star].extraUpdates = 4; diff --git a/Projectiles/Ranged/TauCannonHoldout.cs b/Projectiles/Ranged/TauCannonHoldout.cs index 216a74c57f..71a4e9c79a 100644 --- a/Projectiles/Ranged/TauCannonHoldout.cs +++ b/Projectiles/Ranged/TauCannonHoldout.cs @@ -9,6 +9,7 @@ using ReLogic.Content; using ReLogic.Utilities; using Terraria; using Terraria.Audio; +using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged @@ -255,7 +256,7 @@ namespace CalamityMod.Projectiles.Ranged float randomRadius = Utils.Remap(Timer, 0f, TimePerCharge * 3f, 5f, 15f); Dust orbDust = Dust.NewDustPerfect( GunTipPosition + Main.rand.NextVector2Circular(randomRadius, randomRadius), - 278, + DustID.FireworksRGB, -Vector2.UnitY.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5f) * Utils.Remap(Timer, 0f, TimePerCharge * 3f, 1f, 5f), Scale: Main.rand.NextFloat(0.3f, 0.9f)); orbDust.noGravity = true; @@ -299,13 +300,14 @@ namespace CalamityMod.Projectiles.Ranged AIState.Level3 => 36, AIState.Level2 => 24, AIState.Level1 => 12, + _ => 0 }; for (int i = 0; i < dustAmount; i++) { float angle = MathHelper.TwoPi / dustAmount * i; Vector2 velocity = angle.ToRotationVector2() * 8f; - Dust chargeDust = Dust.NewDustPerfect(GunTipPosition, 267, velocity, Scale: Utils.Remap(dustAmount, 10f, 30f, 1.5f, 2.2f)); + Dust chargeDust = Dust.NewDustPerfect(GunTipPosition, DustID.RainbowMk2, velocity, Scale: Utils.Remap(dustAmount, 10f, 30f, 1.5f, 2.2f)); chargeDust.noGravity = true; chargeDust.noLight = true; chargeDust.noLightEmittence = true; @@ -328,6 +330,7 @@ namespace CalamityMod.Projectiles.Ranged AIState.Level3 => ChargeLV2Sound, AIState.Level2 => ChargeLV1Sound, AIState.Level1 => ChargeLV1Sound, + _ => ChargeLV1Sound }; SoundEngine.PlaySound(chargeSound, GunTipPosition); diff --git a/Projectiles/Rogue/LeviathanToothStealth.cs b/Projectiles/Rogue/LeviathanToothStealth.cs index d727b1a8a8..807d174e87 100644 --- a/Projectiles/Rogue/LeviathanToothStealth.cs +++ b/Projectiles/Rogue/LeviathanToothStealth.cs @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Rogue if (!spawnedDust && toothNum > 1) { - Dust dust = Dust.NewDustPerfect(finalDrawPos, 5, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.5f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), 100, default, Main.rand.NextFloat(1.1f, 1.9f) * scale); + Dust dust = Dust.NewDustPerfect(finalDrawPos, DustID.Blood, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.5f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), 100, default, Main.rand.NextFloat(1.1f, 1.9f) * scale); dust.noGravity = true; dust.alpha = (int)(255 * (1 - toothOpacity)); Particle blood = new CustomSpark(finalDrawPos, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.4f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), "CalamityMod/Particles/LargeBloom", @@ -187,15 +187,13 @@ namespace CalamityMod.Projectiles.Rogue if (!canDamage) return false; - Player Owner = Main.player[Projectile.owner]; Vector2 start = Projectile.Center; float length = jawLength; float size = 165; float _ = float.NaN; - bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); - return (hit); - return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox); + bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); + return hit; } } } diff --git a/Projectiles/Rogue/PumkaboomBoomBig.cs b/Projectiles/Rogue/PumkaboomBoomBig.cs new file mode 100644 index 0000000000..695c73889a --- /dev/null +++ b/Projectiles/Rogue/PumkaboomBoomBig.cs @@ -0,0 +1,35 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class PumpkaboomBoomBig : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 230, targetHitbox); + } +} diff --git a/Projectiles/Rogue/PumkaboomBoomSmall.cs b/Projectiles/Rogue/PumkaboomBoomSmall.cs new file mode 100644 index 0000000000..8a865e6bb0 --- /dev/null +++ b/Projectiles/Rogue/PumkaboomBoomSmall.cs @@ -0,0 +1,35 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class PumpkaboomBoomSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 40; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 170, targetHitbox); + } +} diff --git a/Projectiles/Rogue/PumpkaboomBig.cs b/Projectiles/Rogue/PumpkaboomBig.cs new file mode 100644 index 0000000000..ebdee114ff --- /dev/null +++ b/Projectiles/Rogue/PumpkaboomBig.cs @@ -0,0 +1,435 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Ravager; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Sounds; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + [PierceResistException] + public class PumpkaboomBig : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/Rogue/PumpkaboomBig"; + public ref float time => ref Projectile.ai[0]; + public ref float skipExplosionSound => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public int tileHits = 0; + public bool flung = false; + public float charge = 0; + public bool hasReachedFullCharge = false; + public bool hasStoppedHolding = false; + public float midAirRot = 0; + public int initialCastDirection = 0; + + public bool stuck = false; + public int stuckNPC = -1; + Vector2 placementDistance; + Vector2 placementVelocity; + + private bool beginStretchAnim = false; + private float progress = -1; + + public Color mainColor = Color.White; + public Color c1 = new Color(255, 117, 24); // Orange + public Color c2 = new Color(168, 47, 57); // Maroon / Darkish Red + public float glowProgress = -1; + public Color shiftColor; + + public NPC markedTarget; + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + + Projectile.timeLeft = 1200; + Projectile.DamageType = RogueDamageClass.Instance; + } + public override bool ShouldUpdatePosition() => flung && !stuck; + public override bool? CanDamage() => (flung && tileHits == 0 ? null : false); + + private bool hasDealtDamage = false; + + public override bool? CanHitNPC(NPC target) + { + if (hasDealtDamage) + return false; + + return null; + } + + public override void AI() + { +            // Outline color shifting +            float rate = (Main.GlobalTimeWrappedHourly * 6); + List eColors = new List() + { + c1, + c2 + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // Progress through squash n stretch anim on hit + if (progress >= 0f && progress < 1f) + { + progress += 0.08f; + } + +            // When an NPC is hit by the bomb, stick to it. +            if (stuck) + { + if (stuckNPC >= 0 && Main.npc[stuckNPC].active) + { + Projectile.Center = Main.npc[stuckNPC].Center + placementVelocity * placementDistance; + } + + else + { + Projectile.Kill(); + } + + if (Projectile.timeLeft == 109) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/PumpkaboomStealthTicking") with { Pitch = 0f, Volume = 1f, MaxInstances = 4 }, Projectile.Center); + } + + if (Projectile.timeLeft < 110) + { + // Pull in small NPCs + float pullStrength = 9f; + float centerShift = 1f; + float maxPullDistance = 240f; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < maxPullDistance) + { + // Avoid pulling the NPC the bomb is stuck to + if (target.whoAmI == stuckNPC) + continue; + + Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); + target.velocity = Vector2.Lerp(target.velocity, moveDir * pullStrength, 0.15f); + target.Center += moveDir * centerShift; + } + } + if (Main.rand.NextBool(3)) + { + Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(9.5f, 13f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 160, ModContent.DustType(), -dustVel2 * 1.2f, 0, default, Main.rand.NextFloat(0.9f, 1.4f)); + dust2.noGravity = true; + dust2.fadeIn = 0.8f; + dust2.color = c1; + } + } + return; + } + + if (flung) + { + if (initialCastDirection == 0) + initialCastDirection = Owner.direction; + + // stuckNPC index + Projectile.localAI[0]++; + Projectile.localAI[1] = 5; // The item can be used again once flung. + + Projectile.velocity.Y += 0.22f; + + if (!stuck) + midAirRot += 0.03f * initialCastDirection; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + midAirRot; + } + + // While in hand + else + { + Projectile.velocity = Owner.velocity; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. Scales with speed. + if (completion >= 1 || hasReachedFullCharge) // The moment of being thrown. + { + time = -1; + Projectile.Center = Owner.Center; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + Projectile.velocity = velocity * 16; + + Projectile.tileCollide = true; + flung = true; + } + + else + { + if (Main.mouseLeft && !hasStoppedHolding) // The charging up. +                    { + if (completion >= 0.7f && completion <= 0.8f) + { + time--; + if (charge < 1) + charge += 0.5f; + + if (charge >= 1 && !hasReachedFullCharge) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + hasReachedFullCharge = true; + } + } + } + else + { + if (!hasReachedFullCharge) + { + Projectile.localAI[1] = 5; + Projectile.ai[1] = 1; // Skip explosion fx + Projectile.Kill(); + } + hasStoppedHolding = true; + } + + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float grenadeRot = 0; + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction); + } + grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction); + + Projectile.Center = grenadePos; + Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + stuck = true; + stuckNPC = target.whoAmI; + + Projectile.localAI[1] = 5; // Reset firing state + + // See PreDraw + beginStretchAnim = true; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle w = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud"); + SoundEngine.PlaySound(w with { Volume = 0.7f, Pitch = 0f, MaxInstances = 6 }, Projectile.Center); + + stuck = true; + stuckNPC = target.whoAmI; + + placementDistance = new(-Vector2.Distance(target.Center, Projectile.Center)); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Projectile.rotation = Projectile.oldVelocity.ToRotation() + MathHelper.PiOver2 + midAirRot; + Projectile.ai[1] = Projectile.rotation; + + hasDealtDamage = true; + Projectile.localAI[1] = 5; // Reset firing state + + glowProgress = 0; // Start glowing until death + + Projectile.timeLeft = 110; // Lasts as long as sfx + + for (int i = 0; i < 6; i++) + { + int sparkLifetime = Main.rand.Next(13, 22); + float sparkScale = Main.rand.NextFloat(0.55f, 1.1f); + Color sparkColor = Main.rand.NextBool() ? c1 : c2; + + Vector2 burstDirection = Projectile.oldVelocity + new Vector2(Main.rand.NextFloat(-2.25f, 2.25f), Main.rand.NextFloat(-6.75f, 6.75f)); + Vector2 spawnPos = target.Center + burstDirection * target.width * 0.15f; + Vector2 sparkVelocity = burstDirection * Main.rand.NextFloat(0.7f, 1.3f); + + if (Main.rand.NextBool()) + { + AltSparkParticle spark = new AltSparkParticle(spawnPos, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + else + { + LineParticle spark = new LineParticle(spawnPos, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override void OnKill(int timeLeft) + { + Projectile.localAI[1] = 5; // Reset firing state + + if (Projectile.ai[1] != 1) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 5f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0); + + float scale = 0.18f; + Vector2 spawnPos = Projectile.Center; + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, c1, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, 10); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(spawnPos, Vector2.Zero, c1 * 0.33f, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale * 1.66f, 11); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int k = 0; k < 16; k++) + { + Vector2 velocity = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.7f, 1.3f); + Particle spark = new SparkParticle(Projectile.Center + velocity, velocity, false, 45, Main.rand.NextFloat(0.95f, 1.35f), c1); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 30; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + velocity, 259, velocity); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + } + } + + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 21, targetHitbox); + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + if (beginStretchAnim) + { + progress = 0f; + beginStretchAnim = false; + } + + if (progress >= 0f) + { + float stretchFactorX, stretchFactorY; + + if (progress < 0.5f) // Stretch + { + float completion = progress / 0.5f; + stretchFactorX = MathHelper.Lerp(1.7f, 0.7f, completion); + stretchFactorY = MathHelper.Lerp(0.7f, 1.7f, completion); + } + else // Squash + { + float completion = (progress - 0.5f) / 0.5f; + stretchFactorX = MathHelper.Lerp(0.7f, 1f, completion); + stretchFactorY = MathHelper.Lerp(1.7f, 1f, completion); + } + + if (progress >= 1f) + { + stretchFactorX = 1f; + stretchFactorY = 1f; + progress = -1f; + } + + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + Vector2 finalSyringeScale = new Vector2(stretchFactorX, stretchFactorY); + Vector2 finalPos = Projectile.Center - Main.screenPosition; + + Main.spriteBatch.Draw(texture, finalPos, null, lightColor, Projectile.rotation, origin, finalSyringeScale, SpriteEffects.None, 0f); + + return false; + } + + + Texture2D mainTexture = ModContent.Request(Texture).Value; + SpriteEffects spriteEffects = SpriteEffects.None; + + Vector2 drawOrigin = mainTexture.Size() / 2f; + float drawScale = Projectile.scale; + float drawRotation = Projectile.rotation; + Vector2 drawPosition; + + if (stuck && glowProgress >= 0f) + { + glowProgress += 0.03f; + + float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 25f); // Period of full pulse + float pulse = MathHelper.Lerp(0.7f, 1f, glowSine); // Least protruding to most protruding + float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true); // How much the glow overall fades in as it gets closer to exploding + float finalGlowIntensity = pulse * lifeFadeIn; + drawPosition = Projectile.Center - Main.screenPosition; + + // Create 20 copies of the projectile that draw behind with mainColor to create a glowy outline effect + for (int i = 0; i < 20; i++) + { + float rotationOffset = (MathHelper.TwoPi * i / 15); + Vector2 glowOffset = rotationOffset.ToRotationVector2() * (3f + glowSine * 1f) * finalGlowIntensity; + + Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + } + } + + if (!flung) + { + spriteEffects = SpriteEffects.FlipVertically; + + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction); + grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + + Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); + drawPosition = grenadePos - Main.screenPosition; + drawRotation = grenadeRot - MathHelper.ToRadians(25 * completionLerp2) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); + } + else + { + if (stuck) + { + drawRotation = Projectile.ai[1]; + } + drawPosition = Projectile.Center - Main.screenPosition; + } + + // Draw it + Main.spriteBatch.Draw(mainTexture, drawPosition, null, lightColor * (1f - Projectile.alpha / 255f), drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/Projectiles/Rogue/PumpkaboomBig.png b/Projectiles/Rogue/PumpkaboomBig.png new file mode 100644 index 0000000000..70cf124970 Binary files /dev/null and b/Projectiles/Rogue/PumpkaboomBig.png differ diff --git a/Projectiles/Rogue/PumpkaboomSmall.cs b/Projectiles/Rogue/PumpkaboomSmall.cs new file mode 100644 index 0000000000..13e2316232 --- /dev/null +++ b/Projectiles/Rogue/PumpkaboomSmall.cs @@ -0,0 +1,401 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Ravager; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + [PierceResistException] + public class PumpkaboomSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Pumpkaboom"; + public ref float time => ref Projectile.ai[0]; + public ref float skipExplosionSound => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + public int tileHits = 0; + public bool flung = false; + public float charge = 0; + public bool hasReachedFullCharge = false; + public bool hasStoppedHolding = false; + public float midAirRot = 0; + public int initialCastDirection = 0; + + public bool stuck = false; + public int stuckNPC = -1; + Vector2 placementDistance; + Vector2 placementVelocity; + + private bool beginStretchAnim = false; + private float progress = -1; + + public Color mainColor = Color.White; + public Color c1 = new Color(255, 117, 24); // Orange + public Color c2 = new Color(168, 47, 57); // Maroon / Darkish Red + public float glowProgress = -1; + public Color shiftColor; + + public NPC markedTarget; + public override void SetDefaults() + { + Projectile.width = 26; + Projectile.height = 34; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + + Projectile.timeLeft = 1200; + Projectile.DamageType = RogueDamageClass.Instance; + } + public override bool ShouldUpdatePosition() => flung && !stuck; + public override bool? CanDamage() => (flung && tileHits == 0 ? null : false); + + private bool hasDealtDamage = false; + + public override bool? CanHitNPC(NPC target) + { + if (hasDealtDamage) + return false; + + return null; + } + + public override void AI() + { +            // Outline color shifting +            float rate = (Main.GlobalTimeWrappedHourly * 6); + List eColors = new List() + { + c1, + c2 + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // Progress through squash n stretch anim on hit + if (progress >= 0f && progress < 1f) + { + progress += 0.08f; + } + +            // When an NPC is hit by the bomb, stick to it. +            if (stuck) + { + if (stuckNPC >= 0 && Main.npc[stuckNPC].active) + { + Projectile.Center = Main.npc[stuckNPC].Center + placementVelocity * placementDistance; + } + + else + { + Projectile.Kill(); + } + if (Projectile.timeLeft == 109) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/PumpkaboomNormalTicking") with { Pitch = 0f, Volume = 1f, MaxInstances = 4 }, Projectile.Center); + } + return; + } + + if (flung) + { + if (initialCastDirection == 0) + initialCastDirection = Owner.direction; + + // stuckNPC index + Projectile.localAI[0]++; + Projectile.localAI[1] = 5; // The item can be used again once flung. + + Projectile.velocity.Y += 0.22f; + + if (!stuck) + midAirRot += 0.06f * initialCastDirection; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + midAirRot; + } + + // While in hand + else + { + Projectile.velocity = Owner.velocity; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. Scales with speed. + if (completion >= 1 || hasReachedFullCharge) // The moment of being thrown. + { + time = -1; + Projectile.Center = Owner.Center; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + Projectile.velocity = velocity * 16; + + Projectile.tileCollide = true; + flung = true; + } + + else + { + if (Main.mouseLeft && !hasStoppedHolding) // The charging up. +                    { + if (completion >= 0.7f && completion <= 0.8f) + { + time--; + if (charge < 1) + charge += 0.5f; + + if (charge >= 1 && !hasReachedFullCharge) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + hasReachedFullCharge = true; + } + } + } + else + { + if (!hasReachedFullCharge) + { + Projectile.localAI[1] = 5; + Projectile.ai[1] = 1; // Skip explosion fx + Projectile.Kill(); + } + hasStoppedHolding = true; + } + + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float grenadeRot = 0; + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction); + } + grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction); + + Projectile.Center = grenadePos; + Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + stuck = true; + stuckNPC = target.whoAmI; + + Projectile.localAI[1] = 5; // Reset firing state + + // See PreDraw + beginStretchAnim = true; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle w = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud"); + SoundEngine.PlaySound(w with { Volume = 0.7f, Pitch = 0f, MaxInstances = 6 }, Projectile.Center); + + stuck = true; + stuckNPC = target.whoAmI; + + placementDistance = new(-Vector2.Distance(target.Center, Projectile.Center)); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + Projectile.rotation = Projectile.oldVelocity.ToRotation() + MathHelper.PiOver2 + midAirRot; + Projectile.ai[1] = Projectile.rotation; + + hasDealtDamage = true; + Projectile.localAI[1] = 5; // Reset firing state + + glowProgress = 0; // Start glowing until death + + Projectile.timeLeft = 110; // Lasts as long as sfx + + for (int i = 0; i < 4; i++) + { + int sparkLifetime = Main.rand.Next(11, 19); + float sparkScale = Main.rand.NextFloat(0.5f, 1f); + Color sparkColor = Main.rand.NextBool() ? c1 : c2; + + Vector2 burstDirection = Projectile.oldVelocity + new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-6f, 6f)); + Vector2 spawnPos = target.Center + burstDirection * target.width * 0.15f; + Vector2 sparkVelocity = burstDirection * Main.rand.NextFloat(0.7f, 1.3f); + + if (Main.rand.NextBool()) + { + AltSparkParticle spark = new AltSparkParticle(spawnPos, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + + else + { + LineParticle spark = new LineParticle(spawnPos, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override void OnKill(int timeLeft) + { + Projectile.localAI[1] = 5; // Reset firing state + + if (Projectile.ai[1] != 1) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.4f }, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0); + + float scale = 0.1f; + Vector2 spawnPos = Projectile.Center; + Particle blastRing = new CustomPulse(spawnPos, Vector2.Zero, c1, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale, 10); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(spawnPos, Vector2.Zero, c1 * 0.33f, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.07f, scale * 1.66f, 11); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int k = 0; k < 8; k++) + { + Vector2 velocity = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.66f, 1f); + Particle spark = new SparkParticle(Projectile.Center + velocity, velocity, false, 24, Main.rand.NextFloat(0.75f, 1.15f), c1); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int k = 0; k < 20; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + velocity, 259, velocity); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + } + } + + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18, targetHitbox); + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + if (beginStretchAnim) + { + progress = 0f; + beginStretchAnim = false; + } + + if (progress >= 0f) + { + float stretchFactorX, stretchFactorY; + + if (progress < 0.5f) // Stretch + { + float completion = progress / 0.5f; + stretchFactorX = MathHelper.Lerp(1.7f, 0.7f, completion); + stretchFactorY = MathHelper.Lerp(0.7f, 1.7f, completion); + } + else // Squash + { + float completion = (progress - 0.5f) / 0.5f; + stretchFactorX = MathHelper.Lerp(0.7f, 1f, completion); + stretchFactorY = MathHelper.Lerp(1.7f, 1f, completion); + } + + if (progress >= 1f) + { + stretchFactorX = 1f; + stretchFactorY = 1f; + progress = -1f; + } + + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(texture.Width * 0.5f, texture.Height * 0.5f); + Vector2 finalSyringeScale = new Vector2(stretchFactorX, stretchFactorY); + Vector2 finalPos = Projectile.Center - Main.screenPosition; + + Main.spriteBatch.Draw(texture, finalPos, null, lightColor, Projectile.rotation, origin, finalSyringeScale, SpriteEffects.None, 0f); + + return false; + } + + + Texture2D mainTexture = ModContent.Request(Texture).Value; + SpriteEffects spriteEffects = SpriteEffects.None; + + Vector2 drawOrigin = mainTexture.Size() / 2f; + float drawScale = Projectile.scale; + float drawRotation = Projectile.rotation; + Vector2 drawPosition; + + if (stuck && glowProgress >= 0f) + { + glowProgress += 0.03f; + + float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f); // Period of full pulse + float pulse = MathHelper.Lerp(0.7f, 1f, glowSine); // Least protruding to most protruding + float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true); // How much the glow overall fades in as it gets closer to exploding + float finalGlowIntensity = pulse * lifeFadeIn; + drawPosition = Projectile.Center - Main.screenPosition; + + // Create 15 copies of the projectile that draw behind with mainColor to create a glowy outline effect + for (int i = 0; i < 15; i++) + { + float rotationOffset = (MathHelper.TwoPi * i / 15); + Vector2 glowOffset = rotationOffset.ToRotationVector2() * (3f + glowSine * 1f) * finalGlowIntensity; + + Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + } + } + + if (!flung) + { + spriteEffects = SpriteEffects.FlipVertically; + + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + float grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction); + grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + + Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot); + drawPosition = grenadePos - Main.screenPosition; + drawRotation = grenadeRot - MathHelper.ToRadians(25 * completionLerp2) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0); + } + else + { + if (stuck) + { + drawRotation = Projectile.ai[1]; + } + drawPosition = Projectile.Center - Main.screenPosition; + } + + // Draw it + Main.spriteBatch.Draw(mainTexture, drawPosition, null, lightColor * (1f - Projectile.alpha / 255f), drawRotation, drawOrigin, drawScale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs index 14b31a2c20..2b0fab8e3d 100644 --- a/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs +++ b/Projectiles/Rogue/SamsaraSlicerSmallDisk.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Rogue public class SamsaraSlicerSmallDisk : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private double rotation = 0; public Projectile Parent = null; public override void SetStaticDefaults() { diff --git a/Projectiles/Summon/FlarebatMinion.cs b/Projectiles/Summon/FlarebatMinion.cs deleted file mode 100644 index 5231d03c3b..0000000000 --- a/Projectiles/Summon/FlarebatMinion.cs +++ /dev/null @@ -1,232 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.Summon; -using CalamityMod.Particles; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Summon -{ - public class FlarebatMinion : BaseMinionProjectile - { - public override int AssociatedProjectileTypeID => ProjectileType(); - - public override int AssociatedBuffTypeID => BuffType(); - - public override ref bool AssociatedMinionBool => ref ModdedOwner.FlarebatBool; - - public override bool PreHardmodeMinionTileVision => true; - - public override int AnimationFrames => 8; - - private Vector2 IdlePosition => Owner.MountedCenter + - -Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f; - - private Action CurrentBehavior; - - [Flags] - private enum AttackBehaviorFlags : byte - { - None = 0, - HasDashed = 1, - HasHitTargetOnDash = 2, - IsReturningToOwner = 4, - } - - private AttackBehaviorFlags AttackState; - - public int MinionIndex; - - public override void SetDefaults() - { - base.SetDefaults(); - (Projectile.width, Projectile.height) = (32, 28); - } - - #region AI - - public override void MinionAI() - { - if (Projectile.ai[0] == 0f) - { - CurrentBehavior = IdleBehavior; - FramesUntilNextAnimationFrame = 3; - - int minionIndex = 0; - foreach (var proj in Main.ActiveProjectiles) - { - if ((proj.type != Type && proj.type != ProjectileType()) || proj.owner != Projectile.owner) - continue; - - if (proj.type == Type) - MinionIndex = minionIndex; - else - proj.ModProjectile().MinionIndex = minionIndex; - - minionIndex++; - } - - Projectile.ai[0]++; - } - - // Teleport to the owner if abnormally far away - if (!Projectile.WithinRange(Owner.Center, 2000f)) - { - Projectile.position = Owner.Center; - Projectile.velocity *= 0.3f; - Projectile.netUpdate = true; - } - - CurrentBehavior.Invoke(); - Projectile.rotation = Projectile.rotation.AngleTowards(MathHelper.ToRadians(Projectile.velocity.X * 3f), 0.2f); - Projectile.spriteDirection = MathF.Sign(Projectile.velocity.X); - - if (!Main.dedServ) - { - if (CurrentBehavior == AttackBehavior || (CurrentBehavior == IdleBehavior && Main.rand.NextBool(10))) - { - Dust ambientDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch); - ambientDust.noGravity = Main.rand.NextBool(); - ambientDust.noLight = true; - ambientDust.noLightEmittence = true; - } - - Lighting.AddLight(Projectile.Center, Color.OrangeRed.ToVector3() * 0.5f); - } - } - - private void IdleBehavior() - { - if (Target is not null) - { - CurrentBehavior = AttackBehavior; - Projectile.velocity = Projectile.DirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver2 * 0.7f) * 10f; - return; - } - - Projectile.velocity = Projectile.DirectionTo(IdlePosition) * Utils.Remap(Projectile.DistanceSQ(IdlePosition), 25600f, 0f, 6f, 0f); - Projectile.MinionAntiClump(); - } - - private void AttackBehavior() - { - if (Target is null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // The first stage is redirecting towards the target. - if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0.96f) - { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.095f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 14f, 0f); - } - - // When it's whithin a distnce and it hasn't dashed yet, it'll dash. - else if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Projectile.DistanceSQ(Target.Center) < 57600f) - { - Projectile.velocity = Projectile.DirectionTo(Target.Center) * 19f; - AttackState |= AttackBehaviorFlags.HasDashed; - Projectile.netUpdate = true; - - if (!Main.dedServ) - { - Particle dashRing = new DirectionalPulseRing( - Projectile.Center, - Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 5f, - Color.OrangeRed, - new Vector2(0.5f, 1f), - Projectile.velocity.ToRotation(), - 0.04f, - 0.4f, - 30); - GeneralParticleHandler.SpawnParticle(dashRing); - - SoundEngine.PlaySound(SoundID.Item1 with { Pitch = 0.5f, PitchVariance = 0.1f, Volume = 0.6f }, Projectile.Center); - } - } - - // The second stage is after the dash. - // If it has hit the target is was supposed to hit or he missed: - // Return to the owner. - if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) - { - if (Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0f || AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash)) - { - AttackState |= AttackBehaviorFlags.IsReturningToOwner; - Projectile.netUpdate = true; - } - } - - // The minion will redirect towards its idle position. - // When it has arrived to it at a distance, reset the state and start over. - if (AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) - { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.095f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 14f, 0f); - - if (Projectile.DistanceSQ(IdlePosition) < 6400f) - { - AttackState = AttackBehaviorFlags.None; - Projectile.netUpdate = true; - } - } - } - - public override bool MinionContactDamage() => true; - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash) && Target == target) - AttackState |= AttackBehaviorFlags.HasHitTargetOnDash; - - target.AddBuff(BuffID.OnFire, 60); - } - - #endregion - - #region Drawing - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = TextureAssets.Projectile[Type].Value; - Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); - Main.EntitySpriteDraw( - texture, - Projectile.Center - Main.screenPosition, - frame, - Color.White * 0.6f, - Projectile.rotation, - frame.Size() * 0.5f, - Projectile.scale, - Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - return false; - } - - #endregion - - #region Syncing - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write7BitEncodedInt(MinionIndex); - writer.Write((byte)AttackState); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - MinionIndex = reader.Read7BitEncodedInt(); - AttackState = (AttackBehaviorFlags)reader.ReadByte(); - } - - #endregion - } -} diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 52e97c0270..cc72dd3d22 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -69,7 +69,6 @@ namespace CalamityMod.Projectiles.Summon float projX = Projectile.position.X; float projY = Projectile.position.Y; float attackDistance = 100000f; - bool canAttack = false; Projectile.ai[0] += 1f; NPC target = null; diff --git a/Projectiles/Summon/FrostbatMinion.cs b/Projectiles/Summon/FrostbatMinion.cs deleted file mode 100644 index a6de4258f3..0000000000 --- a/Projectiles/Summon/FrostbatMinion.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.Summon; -using CalamityMod.Particles; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Summon -{ - public class FrostbatMinion : BaseMinionProjectile - { - public override int AssociatedProjectileTypeID => ProjectileType(); - - public override int AssociatedBuffTypeID => BuffType(); - - public override ref bool AssociatedMinionBool => ref ModdedOwner.FrostbatBool; - - public override bool PreHardmodeMinionTileVision => true; - - public override int AnimationFrames => 8; - - private Vector2 IdlePosition => Owner.MountedCenter + - -Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f; - - private Action CurrentBehavior; - - [Flags] - private enum AttackBehaviorFlags : byte - { - None = 0, - HasDashed = 1, - HasHitTargetOnDash = 2, - IsReturningToOwner = 4, - } - - private AttackBehaviorFlags AttackState; - - public int MinionIndex; - - public override void SetDefaults() - { - base.SetDefaults(); - (Projectile.width, Projectile.height) = (32, 28); - } - - #region AI - - public override void MinionAI() - { - if (Projectile.ai[0] == 0f) - { - CurrentBehavior = IdleBehavior; - FramesUntilNextAnimationFrame = 3; - - int minionIndex = 0; - foreach (var proj in Main.ActiveProjectiles) - { - if ((proj.type != Type && proj.type != ProjectileType()) || proj.owner != Projectile.owner) - continue; - - if (proj.type == Type) - MinionIndex = minionIndex; - else - proj.ModProjectile().MinionIndex = minionIndex; - - minionIndex++; - } - - Projectile.ai[0]++; - } - - CurrentBehavior.Invoke(); - Projectile.rotation = Projectile.rotation.AngleTowards(MathHelper.ToRadians(Projectile.velocity.X * 3f), 0.2f); - Projectile.spriteDirection = MathF.Sign(Projectile.velocity.X); - - if (!Main.dedServ) - { - if (CurrentBehavior == AttackBehavior || (CurrentBehavior == IdleBehavior && Main.rand.NextBool(10))) - { - Dust ambientDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch); - ambientDust.noGravity = Main.rand.NextBool(); - ambientDust.noLight = true; - ambientDust.noLightEmittence = true; - } - - Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.5f); - } - } - - private void IdleBehavior() - { - if (Target is not null) - { - CurrentBehavior = AttackBehavior; - Projectile.velocity = Projectile.DirectionTo(Target.Center).RotatedByRandom(MathHelper.PiOver2 * 0.7f) * 10f; - return; - } - - Projectile.velocity = Projectile.DirectionTo(IdlePosition) * Utils.Remap(Projectile.DistanceSQ(IdlePosition), 25600f, 0f, 6f, 0f); - Projectile.MinionAntiClump(); - } - - private void AttackBehavior() - { - if (Target is null) - { - CurrentBehavior = IdleBehavior; - return; - } - - // The first stage is redirecting towards the target. - if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0.96f) - { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.08f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 8f, 0f); - } - - // When it's whithin a distnce and it hasn't dashed yet, it'll dash. - else if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Projectile.DistanceSQ(Target.Center) < 57600f) - { - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 18f); - AttackState |= AttackBehaviorFlags.HasDashed; - Projectile.netUpdate = true; - - if (!Main.dedServ) - { - Particle dashRing = new DirectionalPulseRing( - Projectile.Center, - Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 5f, - Color.Cyan, - new Vector2(0.5f, 1f), - Projectile.velocity.ToRotation(), - 0.04f, - 0.4f, - 30); - GeneralParticleHandler.SpawnParticle(dashRing); - - SoundEngine.PlaySound(SoundID.Item1 with { Pitch = 0.5f, PitchVariance = 0.1f, Volume = 0.6f }, Projectile.Center); - } - } - - // The second stage is after the dash. - // If it has hit the target is was supposed to hit or he missed: - // Return to the owner. - if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) - { - if (Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0f || AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash)) - { - AttackState |= AttackBehaviorFlags.IsReturningToOwner; - Projectile.netUpdate = true; - } - } - - // The minion will redirect towards its idle position. - // When it has arrived to it at a distance, reset the state and start over. - if (AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) - { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.08f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 8f, 0f); - - if (Projectile.DistanceSQ(IdlePosition) < 6400f) - { - AttackState = AttackBehaviorFlags.None; - Projectile.netUpdate = true; - } - } - } - - public override bool MinionContactDamage() => true; - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && !AttackState.HasFlag(AttackBehaviorFlags.HasHitTargetOnDash) && Target == target) - AttackState |= AttackBehaviorFlags.HasHitTargetOnDash; - - target.AddBuff(BuffID.Frostburn, 60); - } - - #endregion - - #region Drawing - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = TextureAssets.Projectile[Type].Value; - Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Projectile.frame); - Main.EntitySpriteDraw( - texture, - Projectile.Center - Main.screenPosition, - frame, - Color.White * 0.6f, - Projectile.rotation, - frame.Size() * 0.5f, - Projectile.scale, - Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - return false; - } - - #endregion - - #region Syncing - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write7BitEncodedInt(MinionIndex); - writer.Write((byte)AttackState); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - MinionIndex = reader.Read7BitEncodedInt(); - AttackState = (AttackBehaviorFlags)reader.ReadByte(); - } - - #endregion - } -} diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index 4e1654aa79..4459170bff 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Summon public class LuxorsGiftSummon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - private int dust = 3; public NPC targeted; public int attackTime = 0; public override void SetStaticDefaults() @@ -57,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon { bool sparkly = Main.rand.NextBool(3); Vector2 dustVel = -(Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.3f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), sparkly ? 278 : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), sparkly ? DustID.FireworksRGB : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.5f, 1.2f)); dust.noGravity = !sparkly; dust.scale = Main.rand.NextFloat(0.45f, 0.6f) * (sparkly ? 1.6f : 1); dust.color = Color.Lime; diff --git a/Projectiles/Typeless/FestiveWingsOrnament.cs b/Projectiles/Typeless/FestiveWingsOrnament.cs index 4fc2c6a7fb..f502cd8046 100644 --- a/Projectiles/Typeless/FestiveWingsOrnament.cs +++ b/Projectiles/Typeless/FestiveWingsOrnament.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.OrnamentFriendly; - internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { PitchVariance = 0.5f }; + internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { Volume = 0.5f, PitchVariance = 0.5f }; public override void SetStaticDefaults() => Main.projFrames[Type] = Main.projFrames[ProjectileID.OrnamentFriendly]; diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index a99c92601f..0ea16c1483 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Projectiles.Typeless public bool inTiles = false; public float respawnMult = 0; - int postHitTimer = 0; public Color bColor = Color.White; public SlotId digSoundSlot; public int digFXCooldown = 0; diff --git a/Projectiles/Typeless/VictideSpirit.cs b/Projectiles/Typeless/VictideSpirit.cs index 3b6ea32a18..47f2719a4f 100644 --- a/Projectiles/Typeless/VictideSpirit.cs +++ b/Projectiles/Typeless/VictideSpirit.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; - public static Asset GlowTexture; + public static Asset SpiritGlow; public ref float SubmergedTimer => ref Projectile.ai[0]; public ref float DustCounter => ref Projectile.ai[1]; - public override void Load() => GlowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + public override void Load() => SpiritGlow = ModContent.Request("CalamityMod/Particles/BloomCircle"); public override void SetStaticDefaults() { @@ -289,7 +289,7 @@ namespace CalamityMod.Projectiles.Typeless if (Projectile.timeLeft < 180) { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - Texture2D glow = GlowTexture.Value; + Texture2D glow = SpiritGlow.Value; Vector2 drawPos = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Color glowColor = new Color(255, 170, 204) * (0.2f * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.25f) + Utils.Remap(Projectile.timeLeft, 180f, 0f, 0.2f, 0.6f, true)); Main.EntitySpriteDraw(glow, drawPos, null, glowColor, Projectile.rotation, glow.Size() * 0.5f, new Vector2(0.6f, 0.5f), SpriteEffects.None); diff --git a/Schematics/Arsenal_Lab_Onyx.csch b/Schematics/Arsenal_Lab_Onyx.csch index f5fd823ae0..feedc64d68 100644 Binary files a/Schematics/Arsenal_Lab_Onyx.csch and b/Schematics/Arsenal_Lab_Onyx.csch differ diff --git a/Schematics/Arsenal_Lab_Plague.csch b/Schematics/Arsenal_Lab_Plague.csch index 5c0bd55727..c92d42a573 100644 Binary files a/Schematics/Arsenal_Lab_Plague.csch and b/Schematics/Arsenal_Lab_Plague.csch differ diff --git a/Schematics/Arsenal_Lab_Planetoid.csch b/Schematics/Arsenal_Lab_Planetoid.csch index 028c2220d5..32850755d1 100644 Binary files a/Schematics/Arsenal_Lab_Planetoid.csch and b/Schematics/Arsenal_Lab_Planetoid.csch differ diff --git a/Sounds/Custom/RedJewelModeShift.ogg b/Sounds/Custom/RedJewelModeShift.ogg new file mode 100644 index 0000000000..873945c7bf Binary files /dev/null and b/Sounds/Custom/RedJewelModeShift.ogg differ diff --git a/Sounds/Item/PumpkaboomNormalTicking.ogg b/Sounds/Item/PumpkaboomNormalTicking.ogg new file mode 100644 index 0000000000..fd21144e98 Binary files /dev/null and b/Sounds/Item/PumpkaboomNormalTicking.ogg differ diff --git a/Sounds/Item/PumpkaboomStealthTicking.ogg b/Sounds/Item/PumpkaboomStealthTicking.ogg new file mode 100644 index 0000000000..d05f87c436 Binary files /dev/null and b/Sounds/Item/PumpkaboomStealthTicking.ogg differ diff --git a/Sounds/Item/StarfleetFire.ogg b/Sounds/Item/StarfleetFire.ogg new file mode 100644 index 0000000000..7c44495a39 Binary files /dev/null and b/Sounds/Item/StarfleetFire.ogg differ diff --git a/Sounds/Item/StarfleetStarburst.ogg b/Sounds/Item/StarfleetStarburst.ogg new file mode 100644 index 0000000000..71e89d12eb Binary files /dev/null and b/Sounds/Item/StarfleetStarburst.ogg differ diff --git a/Sounds/Item/StarmadaFire.ogg b/Sounds/Item/StarmadaFire.ogg new file mode 100644 index 0000000000..32a54102f8 Binary files /dev/null and b/Sounds/Item/StarmadaFire.ogg differ diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs index 9e653f588b..596ac189ab 100644 --- a/Systems/Collections/CalamityNPCSets.cs +++ b/Systems/Collections/CalamityNPCSets.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), @@ -176,21 +176,13 @@ namespace CalamityMod.Systems.Collections NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, NPCID.MothronEgg, NPCID.MothronSpawn); - // TODO: This set should really also handle the actual splitting behavior and loot, but unsure of the best way to do that looking at what we have right now - /// - /// If for an NPC type, then that NPC is part of a worm which splits in Death Mode. Solely used to reduce their max health to 15% of its standard value.
- /// Defaults to . - ///
- public static bool[] DeathModeSplittingWorm = Factory.CreateBoolSet(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail, - NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail, NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); - /// /// If for an NPC type, then the NPC will receive a 30 second global cooldown to slowing debuffs after being inflicted by one.
/// Also used to prevent weapon pulling effects and Anarchy Blade's ability to instantly kill enemies that are below 50% health.
/// Defaults to . ///
- public static bool[] ResistSlowingDebuffsAndOtherSpecialEffects = Factory.CreateBoolSet(NPCID.KingSlime, NPCType(), NPCType(), - NPCType(), NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, + public static bool[] ResistSlowingDebuffsAndOtherSpecialEffects = Factory.CreateBoolSet(NPCID.KingSlime, NPCType(), + NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.Plantera, NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, NPCID.Pumpking, NPCID.Mothron, @@ -230,8 +222,6 @@ namespace CalamityMod.Systems.Collections { NPCID.RainbowSlime, 30000 }, { NPCID.Pinky, 15000 }, { NPCType(), 21000 }, - { NPCType(), 18000 }, - { NPCType(), 24000 }, { NPCID.EyeofCthulhu, 450000 }, // 30 seconds { NPCID.ServantofCthulhu, 6000 }, { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start diff --git a/Systems/Graphic/LavaRenderingSystem.cs b/Systems/Graphic/LavaRenderingSystem.cs index 84d5f6cce2..d96ff9c4f8 100644 --- a/Systems/Graphic/LavaRenderingSystem.cs +++ b/Systems/Graphic/LavaRenderingSystem.cs @@ -760,13 +760,8 @@ namespace CalamityMod.Systems int num34 = -1; int num45 = -1; float num47 = 0f; - float num48 = 99999f; - float num49 = 99999f; int num50 = -1; int num2 = -1; - Rectangle value = default(Rectangle); - Rectangle value2 = default(Rectangle); - Vector2 origin = default(Vector2); for (int i = 0; i < currentMax; i++) { if (waterfalls[i].type != 1) diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index fa7a0a62b8..60a4fd1425 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -10,11 +10,11 @@ namespace CalamityMod.Tiles.Abyss { public class RustyChestTile : ModTile { - public static int Type; + public static int TileType; public override void SetStaticDefaults() { - Type = (ushort)ModContent.TileType(); + TileType = (ushort)ModContent.TileType(); this.SetUpChest(ModContent.ItemType()); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); diff --git a/Tiles/Furniture/CalamityCanvas2023Tile.cs b/Tiles/Furniture/CalamityCanvas2023Tile.cs index b5693bbff7..a09418f8e9 100644 --- a/Tiles/Furniture/CalamityCanvas2023Tile.cs +++ b/Tiles/Furniture/CalamityCanvas2023Tile.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Tiles.Furniture Tile t = Main.tile[i, j]; Texture2D texture = TextureAssets.Tile[Type].Value; TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 1, 1); - float baseDimension = 80; // 5 * 16 + Vector2 pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; if (cube != null && t.TileFrameX == 0) { diff --git a/Tiles/Furniture/CalamityCanvas2024Tile.cs b/Tiles/Furniture/CalamityCanvas2024Tile.cs index 70df710ad1..70fa5b30de 100644 --- a/Tiles/Furniture/CalamityCanvas2024Tile.cs +++ b/Tiles/Furniture/CalamityCanvas2024Tile.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Tiles.Furniture Tile t = Main.tile[i, j]; Texture2D texture = TextureAssets.Tile[Type].Value; TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 1, 1); - float baseDimension = 80; // 5 * 16 + Vector2 pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; if (cube != null && t.TileFrameX == 0) { diff --git a/Tiles/FurnitureMonolith/AstralMonolith.cs b/Tiles/FurnitureMonolith/AstralMonolith.cs index b6d82a7aec..42810cbfb6 100644 --- a/Tiles/FurnitureMonolith/AstralMonolith.cs +++ b/Tiles/FurnitureMonolith/AstralMonolith.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int yPos = tile.TileFrameY; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Astral/AstralMonolithGlow").Value; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/AstralMonolithGlow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(50, 50, 50, 50)); diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 7ec43cdd31..a94b30f75d 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -386,14 +386,14 @@ namespace CalamityMod.Tiles case 103: npc = NPCType(); break; - /*case 104: - npc = NPCType(); - Formerly Blinded Angler - break*/ + case 104: + npc = NPCType(); + break; case 105: npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam @@ -467,6 +467,69 @@ namespace CalamityMod.Tiles case 130: npc = NPCType(); break; + case 131: + npc = NPCType(); + break; + /* case 132: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ + /* case 133: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ + case 134: + npc = NPCType(); + break; + case 135: + npc = NPCType(); + break; + case 136: + npc = NPCType(); + break; + case 137: + npc = NPCType(); + break; + case 138: + npc = NPCType(); + break; + /* case 139: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ + /* case 140: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ + case 141: + npc = NPCType(); // Logic should be applying to other variants + break; + case 142: + npc = NPCType(); + break; + case 143: + npc = NPCType(); + break; + case 144: + npc = NPCType(); + break; + case 145: + npc = NPCType(); + break; + case 146: + npc = NPCType(); + break; + case 147: + npc = NPCType(); + break; + /* case 148: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ + case 149: + npc = NPCType(); + break; + case 150: + npc = NPCType(); + break; + /* case 151: + npc = NPCType(); // NOT YET IMPLEMENTED. Banner sprite is already on the mastersheet and associated with this case/position. + break; */ default: break; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 139aa66e76..4142434796 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index 82bcf2a992..e970458711 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -99,10 +99,10 @@ namespace CalamityMod.UI.ResourceSets if (drawingLife) { - if (!CalPlayer.chaliceOfTheBloodGod) return; - var bleed = CalPlayer.chaliceBleedoutBuffer; - var hearts = snapshot.AmountOfLifeHearts; - var height = 0; + if (!CalPlayer.chaliceOfTheBloodGod) + return; + var bleed = CalPlayer.chaliceBleedoutBuffer; + var hearts = snapshot.AmountOfLifeHearts; int drawType = -1; //0 - bars 1- regular heart 2 - fancy heart Vector2 position = new Vector2(Main.screenWidth - 60, 28); @@ -110,16 +110,13 @@ namespace CalamityMod.UI.ResourceSets switch (displaySet.NameKey) { case "HorizontalBarsWithText": - height = 12; drawType = 0; break; case "HorizontalBarsWithFullText": - height = 12; position.Y -= 2; drawType = 0; break; case "HorizontalBars": - height = 12; position.Y -= 4; drawType = 0; break; @@ -200,9 +197,8 @@ namespace CalamityMod.UI.ResourceSets // This is where Mana Burn is drawn else if (Player.statMana < 0) { - var mana = -Player.statMana; - var stars = snapshot.AmountOfManaStars; - var height = 0; + var mana = -Player.statMana; + var stars = snapshot.AmountOfManaStars; int drawType = -1; //0 - bars 1- regular heart 2 - fancy heart Vector2 position = new Vector2(Main.screenWidth - 70, 52); @@ -210,16 +206,13 @@ namespace CalamityMod.UI.ResourceSets switch (displaySet.NameKey) { case "HorizontalBarsWithText": - height = 12; drawType = 0; break; case "HorizontalBarsWithFullText": - height = 12; position.Y -= 2; drawType = 0; break; case "HorizontalBars": - height = 12; position.Y -= 4; drawType = 0; break; diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index ad67fc4a9b..f9a001ad6f 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -171,8 +171,6 @@ namespace CalamityMod EnemyStats.DebuffImmunities = new SortedDictionary> { { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, diff --git a/Waters/BasaltGullyWater.cs b/Waters/BasaltGullyWater.cs index ffa6cf1762..e29677d136 100644 --- a/Waters/BasaltGullyWater.cs +++ b/Waters/BasaltGullyWater.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Waters if (outputColor == Vector3.One || outputColor == new Vector3(0.25f, 0.25f, 0.25f) || outputColor == new Vector3(0.5f, 0.5f, 0.5f)) return; - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } diff --git a/Waters/SulphuricDepthsWater.cs b/Waters/SulphuricDepthsWater.cs index 4642b32461..2ea476b384 100644 --- a/Waters/SulphuricDepthsWater.cs +++ b/Waters/SulphuricDepthsWater.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Waters { Vector3 outputColor = new Vector3(r, g, b); - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); } diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 72135efa68..8f1e476b22 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Waters GeneralParticleHandler.SpawnParticle(acidFoam); } - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { if (Main.dayTime && !Main.raining) { diff --git a/Waters/SunkenSeaBurrowsWater.cs b/Waters/SunkenSeaBurrowsWater.cs index 25be900b27..89c13859d4 100644 --- a/Waters/SunkenSeaBurrowsWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Waters { Vector3 outputColor = new Vector3(r, g, b); - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } diff --git a/Waters/SunkenSeaPolypWater.cs b/Waters/SunkenSeaPolypWater.cs index 7967539d7f..1aa13ee354 100644 --- a/Waters/SunkenSeaPolypWater.cs +++ b/Waters/SunkenSeaPolypWater.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Waters { Vector3 outputColor = new Vector3(r, g, b); - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } diff --git a/Waters/SunkenSeaReefsWater.cs b/Waters/SunkenSeaReefsWater.cs index e0db74851a..f30fd3a82b 100644 --- a/Waters/SunkenSeaReefsWater.cs +++ b/Waters/SunkenSeaReefsWater.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Waters { Vector3 outputColor = new Vector3(r, g, b); - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index ae828a4fa8..1f34f44f61 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Waters { Vector3 outputColor = new Vector3(r, g, b); - if (tile.TileType != RustyChestTile.Type) + if (tile.TileType != RustyChestTile.TileType) { CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } diff --git a/World/GiantHive.cs b/World/GiantHive.cs index cca8d6cd37..b5fbcbd987 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -241,7 +241,7 @@ namespace CalamityMod.World } // Honey chests - Vector2 honeyChestLocation = default; + //Vector2 honeyChestLocation = default; //for (int l = 0; l < maxAttempts; l++) //{ // Vector2 newStructureLocation = larvaLocation; diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index fe847dcf80..f4d2c5f018 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1547,7 +1547,7 @@ namespace CalamityMod.World if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) { t.HasTile = false; - t.LiquidType = 1; + t.LiquidType = LiquidID.Lava; } float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; @@ -1630,7 +1630,7 @@ namespace CalamityMod.World //get rid of water if (Main.tile[X, Y].LiquidType == LiquidID.Water) { - t.LiquidType = 1; + t.LiquidType = LiquidID.Lava; } //get rid of obsidian blocks @@ -1694,12 +1694,9 @@ namespace CalamityMod.World //Timeless Shores ambiant tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { - int Rand3() => WorldGen.genRand.Next(3); - int MediumShorePileVariants = Rand3(); - int Rand6() => WorldGen.genRand.Next(6); - int DriftwoodVariants = Rand6(); - int Rand9() => WorldGen.genRand.Next(9); - int ShorePileVariants = Rand9(); + int MediumShorePileVariants = WorldGen.genRand.Next(3); + int DriftwoodVariants = WorldGen.genRand.Next(6); + int ShorePileVariants = WorldGen.genRand.Next(9); //Driftwood Ambiance if (WorldGen.genRand.NextBool(100)) { @@ -1749,8 +1746,7 @@ namespace CalamityMod.World if (Main.tile[X, Y].TileType == ModContent.TileType()) { - int Rand6() => WorldGen.genRand.Next(6); - int DriftwoodVariants = Rand6(); + int DriftwoodVariants = WorldGen.genRand.Next(6); //Driftwood Ambiance if (WorldGen.genRand.NextBool(80)) { @@ -1771,8 +1767,7 @@ namespace CalamityMod.World //gleaming burrows ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { - int Rand6() => WorldGen.genRand.Next(6); - int NavystonePileVariants = Rand6(); + int NavystonePileVariants = WorldGen.genRand.Next(6); //brain coral if (WorldGen.genRand.NextBool(30)) { @@ -1883,11 +1878,9 @@ namespace CalamityMod.World } if (Main.tile[X, Y].TileType == ModContent.TileType()) { - int Rand3() => WorldGen.genRand.Next(3); int TableCoralVariants = WorldGen.genRand.Next(3); int SpeleothemsVariants = WorldGen.genRand.Next(3); - int Rand6() => WorldGen.genRand.Next(6); - int NavystonePileVariants = Rand6(); + int NavystonePileVariants = WorldGen.genRand.Next(6); if (WorldGen.genRand.NextBool(30) && !Main.tile[X + 1, Y].HasTile) { @@ -1970,14 +1963,9 @@ namespace CalamityMod.World } if (Main.tile[X, Y].TileType == ModContent.TileType()) { - int Rand8() => WorldGen.genRand.Next(8); - int BranchCoralVariants = Rand8(); - - int Rand4() => WorldGen.genRand.Next(4); - int WideScarletSeagrassVariants = Rand4(); - - int Rand6() => WorldGen.genRand.Next(6); - int DriftwoodVariants = Rand6(); + int BranchCoralVariants = WorldGen.genRand.Next(8); + int WideScarletSeagrassVariants = WorldGen.genRand.Next(4); + int DriftwoodVariants = WorldGen.genRand.Next(6); //BranchCoralsOnSand if (WorldGen.genRand.NextBool(25)) @@ -2078,8 +2066,7 @@ namespace CalamityMod.World })); } - int Rand6() => WorldGen.genRand.Next(6); - int DriftwoodVariants = Rand6(); + int DriftwoodVariants = WorldGen.genRand.Next(6); //Driftwood Ambiance if (WorldGen.genRand.NextBool(30)) {