diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7e939836f1..c0ded3f947 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -877,6 +877,7 @@ namespace CalamityMod.CalPlayer public bool eGauntlet = false; /// public bool eGauntletVisuals = true; + public bool volatileGelatinVisuals = true; /// /// Used to prevent melee speed stacking with Feral Claws and its upgrades.
/// Feral Claws = 1, Power Glove = 2, Mechanical Glove = 3, Fire Gauntlet = 4, Elemental Gauntlet = 5 @@ -1152,6 +1153,7 @@ namespace CalamityMod.CalPlayer public int voidFrameCounter = 0; /// public int voidFrame = 0; + public int volatileGelHits = 0; public bool rottenDogTooth = false; public bool angelicAlliance = false; public int angelicActivate = -1; @@ -2404,6 +2406,7 @@ namespace CalamityMod.CalPlayer ascendantInsignia = false; fishStocks = false; magmaStoneVisuals = true; + volatileGelatinVisuals = true; eGauntlet = false; eGauntletVisuals = true; gloveLevel = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 8cd3129a3e..a1b8566dc6 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2941,6 +2941,29 @@ namespace CalamityMod.CalPlayer } } + if (Player.volatileGelatin) + { + Player.volatileGelatinCounter++; + + int npcCount = 0; + int npcType = ModContent.NPCType(); + for (int x = 0; x < Main.maxNPCs; x++) + { + NPC npc = Main.npc[x]; + if (npc.active && npc.type == npcType && npc.ai[1] == Player.whoAmI && npc.ai[3] == 0) + npcCount++; + } + int wingFlatBoost = 15; // 0.3 seconds of flight + float jumpSpeedBoost = 0.25f; // 5% jump speed + + if (Player.wingTimeMax > 0) + Player.wingTimeMax += (wingFlatBoost * npcCount); + Player.jumpSpeedBoost += (jumpSpeedBoost * npcCount); + } + else + volatileGelHits = 0; + + // Vortex Armor nerf if (Player.vortexStealthActive && Player.HeldItem.type != ItemID.PsychoKnife) { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index e184225e10..831dbb3b0b 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1128,6 +1128,10 @@ namespace CalamityMod.Items { modPlayer.magmaStoneVisuals = !hideVisual; // hides the fire dust when hiding the accessory } + if (item.type == ItemID.VolatileGelatin) + { + modPlayer.volatileGelatinVisuals = !hideVisual; + } // Amphibian boots are directly nerfed so they aren't the best in slot boots at all times. if (item.type == ItemID.AmphibianBoots) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 509c7bad01..e51b48f5aa 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -772,6 +772,10 @@ namespace CalamityMod.Items if (item.type == ItemID.GravityGlobe) EditTooltipByNum(1, (line) => line.Text = EditedTooltip("GravityGlobe")); + // Reworked Volatile Gelatin + if (item.type == ItemID.VolatileGelatin) + EditTooltipByNum(0, (line) => line.Text += "\n" + EditedTooltip("VolatileGelatin")); + // Flame Waker Boots now has a functional effect which inherits to Hellfire Treads. if (item.type == ItemID.FlameWakerBoots) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlameWakerBoots")); diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index e21ebc6a6a..1f175c4976 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -284,6 +284,7 @@ SupremeCalamitas.DisplayName: Supreme Witch, Calamitas SupremePermafrost: Supreme Ultramage, Permafrost SupremeCataclysm.DisplayName: Cataclysm SupremeCatastrophe.DisplayName: Catastrophe +VolatileSlime.DisplayName: Volatile Slime Yharon.DisplayName: Yharon, Dragon of Rebirth YharonPhase2: Yharon, Resplendent Phoenix AndroombaFriendly.DisplayName: Androomba Pal diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index d0f4c9fd89..5298cbc8cb 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -195,6 +195,12 @@ EditedTooltip: { All attacks light enemies on fire 'Never get cold feet again' ''' + VolatileGelatin: + ''' + Every 5 volatile gelatins that hit, a winged Volatile Slime will spawn, up to a max of 6 + Each Volatile Slime provides 5% increased jump speed and 0.3 seconds of flight time + Running out of flight time will remove the Volatile Slime's wings and detach them from you + ''' /* Armor */ diff --git a/NPCs/Other/VolatileChain.png b/NPCs/Other/VolatileChain.png new file mode 100644 index 0000000000..32644e4fce Binary files /dev/null and b/NPCs/Other/VolatileChain.png differ diff --git a/NPCs/Other/VolatileSlime.cs b/NPCs/Other/VolatileSlime.cs new file mode 100644 index 0000000000..62bc630d5c --- /dev/null +++ b/NPCs/Other/VolatileSlime.cs @@ -0,0 +1,309 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Principal; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class VolatileSlime : ModNPC + { + public override string Texture => $"Terraria/Images/NPC_{NPCID.QueenSlimeMinionPurple}"; + public ref float time => ref NPC.ai[0]; + public ref float playerID => ref NPC.ai[1]; + public Player owner => Main.player[(int)playerID]; + public bool released => NPC.ai[3] != 0; + public bool doOnSpawnEffects = true; + public Color effectColor = Color.BlueViolet; + public List oldVelocities = new List(); + public Vector2 randPos = Vector2.Zero; + public Vector2 goalPositionRand = Vector2.Zero; + public float travelSpeed = 25; + public float glowScale = 1; + public bool drawChains = true; + public float gravIntensity = 1; + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[Type] = 4; + } + public override void SetDefaults() + { + NPC.width = NPC.height = 40; + NPC.damage = 0; + NPC.defense = 0; + NPC.lifeMax = 75; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.knockBackResist = 0.8f; + NPC.netAlways = true; + NPC.aiStyle = -1; + NPC.Opacity = 0; + NPC.dontTakeDamage = true; + NPC.chaseable = false; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + + NPC.Calamity().ProvidesProximityRage = false; + NPC.Calamity().DoesNotDisappearInBossRush = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(travelSpeed); + writer.Write(gravIntensity); + writer.WriteVector2(goalPositionRand); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + travelSpeed = reader.ReadSingle(); + gravIntensity = reader.ReadSingle(); + goalPositionRand = reader.ReadVector2(); + } + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += 1.0; + if (NPC.frameCounter >= 6.0) + { + NPC.frame.Y += 1; + NPC.frameCounter = 0.0; + } + if (NPC.frame.Y >= (released ? Main.npcFrameCount[Type] / 2 : Main.npcFrameCount[Type])) + NPC.frame.Y = 0; + } + public override void AI() + { + if (doOnSpawnEffects) + { + // In multiplayer, the spawned npc won't spawn with the proper owner, so it just sets it to be the player it spawns on top of + int player = NPC.FindClosestPlayer(); + NPC.ai[1] = player; + + NPC.Opacity = 1; + NPC.scale = 0; + doOnSpawnEffects = false; + NPC.netUpdate = true; + } + float rate = (time * 0.05f); + List eColors = new List() + { + Color.SlateBlue, + Color.BlueViolet + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + effectColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + glowScale = MathHelper.Lerp(glowScale, 1, 0.13f); + + + if (owner.wingTime <= 0 && !released) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 10 }, NPC.Center); + time = 0; + NPC.dontTakeDamage = false; + NPC.noTileCollide = false; + NPC.lavaImmune = false; + NPC.frame.Y = 0; + glowScale = 5f; + gravIntensity = Main.rand.NextFloat(0.8f, 1.3f); + + NPC.ai[3] = 1; // release the slimes + NPC.netUpdate = true; + NPC.SyncMotionToServer(); + } + + if (released) + { + float sine = (float)Math.Sin(time * 0.6f / MathHelper.Pi); + if (NPC.velocity.Y < 12 * gravIntensity) + NPC.velocity.Y += 0.4f * gravIntensity; + if (Math.Abs(NPC.velocity.X) < 5 && time < 120) + NPC.velocity.X *= 1.03f; + else + NPC.velocity.X *= 0.987f; + } + else + { + if (time % 120 == 0) + { + goalPositionRand = Main.rand.NextVector2Circular(90, 90); + NPC.netUpdate = true; + } + randPos = Vector2.Lerp(randPos, goalPositionRand, 0.04f); + + float sineX = (float)Math.Sin(time * 0.4f / MathHelper.Pi); + float sineY = (float)Math.Sin(time * 0.6f / MathHelper.Pi); + + NPC.velocity += owner.velocity; + Vector2 destination = owner.Center - Vector2.UnitY * 120 + randPos + new Vector2(10 * sineX, 15 * sineY); + + // Anticlump + int npcType = ModContent.NPCType(); + for (int x = 0; x < Main.maxNPCs; x++) + { + NPC npc = Main.npc[x]; + float distFromNPC = Vector2.Distance(NPC.Center, npc.Center); + if (npc != NPC && npc.active && npc.type == npcType && npc.ai[1] == owner.whoAmI && npc.ai[3] == 0 && distFromNPC < 150) + destination += Utils.DirectionFrom(NPC.Center, npc.Center) * Utils.GetLerpValue(150, 0, distFromNPC) * 25; + } + travelSpeed = MathHelper.Lerp(travelSpeed, (owner.controlJump ? 2 : 25), 0.03f); + + NPC.velocity = (destination - NPC.Center) / travelSpeed; + + if (owner.controlJump && time % 3 == 0) + NPC.netUpdate = true; + } + if (NPC.velocity.X > 0 || NPC.velocity.X < 0) + NPC.spriteDirection = Math.Sign(NPC.velocity.X); + + if (NPC.scale < 1) + NPC.scale += 0.05f; + + if (NPC.collideX) + { + NPC.velocity.X *= -1.2f; + NPC.netUpdate = true; + } + if (NPC.collideY) + { + NPC.velocity.Y += -5.5f * gravIntensity - NPC.velocity.Y; + NPC.netUpdate = true; + } + + // Kill slime after enough time freed + if (Main.netMode != NetmodeID.MultiplayerClient && ((time >= 600f && released) || (!owner.volatileGelatin) || (owner.dead && !released))) + { + NPC.StrikeInstantKill(); + NPC.netUpdate = true; + } + + time++; + + oldVelocities.Add(NPC.velocity); + int maxSaves = 18; + if (oldVelocities.Count > maxSaves) + oldVelocities.RemoveAt(0); + } + public override void OnKill() + { + if (owner.Calamity().volatileGelatinVisuals) + { + for (int i = 0; i <= 22; i++) + { + Vector2 vel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(3f, 8f); + + Dust dust2 = Dust.NewDustPerfect(NPC.Center, ModContent.DustType(), vel); + dust2.scale = Main.rand.NextFloat(0.8f, 1.7f); + bool gravity = !Main.rand.NextBool(5); + dust2.noGravity = gravity; + if (!gravity) + dust2.velocity /= 2; + dust2.alpha = Main.rand.Next(70, 150 + 1); + dust2.color = Main.rand.NextBool() ? Color.BlueViolet : Color.SlateBlue; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + } + NPC.netUpdate = true; + } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return false; + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = released ? Terraria.GameContent.TextureAssets.Npc[NPCID.QueenSlimeMinionBlue].Value : Terraria.GameContent.TextureAssets.Npc[NPCID.QueenSlimeMinionPurple].Value; + Vector2 drawPosition = NPC.Center - screenPos + (Vector2.UnitY * (released ? 8 : 0)); + Rectangle frame = Utils.Frame(texture, verticalFrames: (released ? Main.npcFrameCount[Type] / 2 : Main.npcFrameCount[Type]), frameY: NPC.frame.Y); + Vector2 origin = frame.Size() * 0.5f; + + if (drawChains) + { + Texture2D chain = ModContent.Request("CalamityMod/NPCs/Other/VolatileChain").Value; + Vector2 end = NPC.Center; + + Vector2 drawStart = owner.Center; + List controlPoints = new List + { + drawStart + }; + for (int i = 0; i < oldVelocities.Count; i++) + { + float swayResponsiveness = Utils.GetLerpValue(0f, 18f, i, true) * Utils.GetLerpValue(oldVelocities.Count, oldVelocities.Count - 18f, i, true) * Utils.GetLerpValue(5, 20, Utils.Distance(drawStart, end), true); + Vector2 swayTotalOffset = oldVelocities.ElementAt(i) * swayResponsiveness * -15; + controlPoints.Add(Vector2.Lerp(drawStart, end, i / (float)oldVelocities.Count) + swayTotalOffset); + } + controlPoints.Add(end); + + int chainPointCount = (int)(Vector2.Distance(controlPoints.First(), controlPoints.Last()) / 11f); + if (chainPointCount < 14) + chainPointCount = 14; + + + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + List chainPoints = bezierCurve.GetPoints(chainPointCount); + + for (int i = 0; i < chainPoints.Count; i++) + { + float completion = Utils.GetLerpValue(chainPoints.Count * 0.2f, chainPoints.Count, i, true); + Vector2 positionAtPoint = chainPoints[i]; + Color color = Color.Lerp(Lighting.GetColor(positionAtPoint.ToTileCoordinates()), effectColor with { A = 0 }, completion); + + if (Vector2.Distance(owner.Center, positionAtPoint) > 1400) + continue; + if (Vector2.Distance(positionAtPoint, NPC.Center) < 10f) + continue; + float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); + angleAtPoint += MathHelper.PiOver2; + + SpriteEffects sprfx = (i % 2 == 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + if (i % 4 < 2) + sprfx |= SpriteEffects.FlipVertically; + + if (released) + { + Vector2 vel = Main.rand.NextVector2Circular(2, 2) + NPC.velocity; + if (owner.Calamity().volatileGelatinVisuals) + { + Particle chainfx = new CustomSpark(positionAtPoint, vel, "CalamityMod/NPCs/Other/VolatileChain", Main.rand.NextBool(3), Main.rand.Next(30, 65), 1f, color, Vector2.One, false, false, -vel.ToRotation() + angleAtPoint, false, false, noShrink: false, spin: Main.rand.NextFloat(0, 0.08f) * Math.Sign(vel.X)); + GeneralParticleHandler.SpawnParticle(chainfx); + } + + drawChains = false; + } + + Main.EntitySpriteDraw(chain, positionAtPoint - Main.screenPosition, null, color * (owner.Calamity().volatileGelatinVisuals ? 1 : 0.05f), angleAtPoint, chain.Size() / 2f, 1.1f - (0.3f * (1 - completion)), sprfx, 0); + } + } + + float sine = (float)Math.Sin(time * 0.2f / MathHelper.Pi); + int draws = 12; + for (int i = 0; i < draws; i++) + { + float rotPoint = MathHelper.TwoPi / draws * i; + float dist = (2.5f + sine) * glowScale; + if (owner.Calamity().volatileGelatinVisuals) + spriteBatch.Draw(texture, drawPosition + rotPoint.ToRotationVector2().RotatedBy(Main.GlobalTimeWrappedHourly * 0.2f) * dist, frame, effectColor with { A = 0 } * NPC.Opacity * 0.6f, NPC.rotation, origin, NPC.scale, NPC.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + } + spriteBatch.Draw(texture, drawPosition, frame, Color.Lerp(drawColor, effectColor with { A = 0 }, Utils.GetLerpValue(1, 3, glowScale)) * NPC.Opacity * (owner.Calamity().volatileGelatinVisuals ? 1f : 0.6f), NPC.rotation, origin, NPC.scale, NPC.spriteDirection == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + return false; + } + } +} diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index cc73c5690e..9d961e3dc6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -24,8 +24,10 @@ using CalamityMod.Items.SummonItems; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; +using CalamityMod.Packets; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -211,6 +213,11 @@ namespace CalamityMod.Projectiles ///
public bool grapeBeer = false; + /// + /// If this proj was spawned from the Volatile Gelatin accessory + /// + public bool volatileGelatinSpawned = false; + /// /// How strong grape beer homing is on this. It speeds up the longer the target is targeted. /// @@ -352,6 +359,33 @@ namespace CalamityMod.Projectiles if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass()) projectile.Calamity().supercritHits = -1; + IEntitySource sourceItemAcc = source as EntitySource_ItemUse; + + + if (projectile.type == ProjectileID.VolatileGelatinBall && source is EntitySource_ItemUse { Item: Item acc }) + { + if (acc == Main.player[projectile.owner].Calamity().FindAccessory(ItemID.VolatileGelatin)) + { + projectile.DamageType = AverageDamageClass.Instance; + projectile.usesIDStaticNPCImmunity = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + if (projectile.extraUpdates == 0) + projectile.extraUpdates = 1; + if (projectile.timeLeft > 700) + projectile.timeLeft = 700; + projectile.damage = (int)(projectile.damage * 0.60f); // 40% damage nerf + NPC closeTarget = projectile.Center.ClosestNPCAt(640); + Vector2 velocity = (projectile.Center.DirectionTo(closeTarget.Center) + closeTarget.velocity * 0.03f).SafeNormalize(Vector2.UnitX); + projectile.velocity = velocity * 12; + projectile.penetrate = 6; // this is for bounces, actually has pierce 4 + Player player = Main.player[projectile.owner]; + projectile.ApplyStatsFromSource(player.GetSource_FromThis()); + projectile.netUpdate = true; + volatileGelatinSpawned = true; // Mark them as Volatile Gelatin origin + } + } + void ApplyGrapeBeer() { grapeBeer = true; @@ -574,6 +608,47 @@ namespace CalamityMod.Projectiles } } + if (volatileGelatinSpawned) + { + Player player = Main.player[projectile.owner]; + if (projectile.timeLeft == 699 && projectile.FinalExtraUpdate() && player.Calamity().volatileGelatinVisuals) + { + for (int i = 0; i <= 14; i++) + { + float variance = Main.rand.NextFloat(-0.4f, 0.4f); + Vector2 vel = projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(variance) * Main.rand.NextFloat(12f, 17f) * (1 - Math.Abs(variance * 1.5f)); + + Dust dust2 = Dust.NewDustPerfect(player.Center, ModContent.DustType(), vel); + dust2.scale = Main.rand.NextFloat(1.7f, 2.5f) * (1 - Math.Abs(variance * 1.5f)); + bool gravity = !Main.rand.NextBool(5); + dust2.noGravity = gravity; + if (!gravity) + dust2.velocity /= 2; + dust2.alpha = Main.rand.Next(70, 150 + 1); + dust2.color = Main.rand.NextBool() ? Color.BlueViolet : Color.SlateBlue; + dust2.noLight = true; + dust2.noLightEmittence = true; + } + + } + if (projectile.timeLeft > 600 && projectile.numHits == 0) + projectile.velocity.Y -= 0.065f; + else if (projectile.velocity.Y < 14) + projectile.velocity.Y += 0.15f; + + float fade = Utils.GetLerpValue(600, 700, projectile.timeLeft, true); + if (fade > 0 && projectile.timeLeft < 695 && Main.player[projectile.owner].Calamity().volatileGelatinVisuals) + { + Particle spark = new CustomSpark(projectile.Center, -projectile.velocity * 0.05f, "CalamityMod/Particles/BloomCircle", false, 11, 0.52f, Color.BlueViolet * 0.5f * fade, new Vector2(0.7f, 1.2f), true, true, glowCenterScale: 0.7f, glowOpacity: 0.5f * fade, shrinkSpeed: 0.14f); + GeneralParticleHandler.SpawnParticle(spark, false, GeneralDrawLayer.BeforeProjectiles); + } + + if (projectile.numHits > 4) + projectile.Kill(); + if (projectile.timeLeft % 5 == 0) + projectile.netUpdate = true; + } + if (projectile.type == ProjectileID.Skull) { bool fromRevSkeletron = projectile.ai[0] < 0f; @@ -4769,6 +4844,48 @@ namespace CalamityMod.Projectiles if (forcedCrit) modifiers.SetCrit(); + if (volatileGelatinSpawned) + { + target.AddBuff(BuffID.GelBalloonBuff, 180); + + float minMult = 0.2f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + + if (projectile.numHits == 0) + player.Calamity().volatileGelHits++; + if (player.Calamity().volatileGelHits == 5) + { + player.Calamity().volatileGelHits = 0; + Vector2 spawnPosition = player.Center; + int npcType = ModContent.NPCType(); + + int slimeCap = 6; + int npcCount = 0; + for (int x = 0; x < Main.maxNPCs; x++) + { + NPC npc = Main.npc[x]; + if (npc.active && npc.type == npcType && npc.ai[1] == player.whoAmI && npc.ai[3] == 0) + npcCount++; + } + + if (npcCount < slimeCap && player.wingTime > 0) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + SpawnNPCOnPlayerPacket.Send(player, (int)spawnPosition.X, (int)spawnPosition.Y, npcType); + } + else if (Main.netMode == NetmodeID.SinglePlayer) + { + NPC slime = NPC.NewNPCDirect(player.GetSource_FromThis(), (int)spawnPosition.X, (int)spawnPosition.Y, npcType, ai1: player.whoAmI, ai2: npcCount); + } + } + } + + projectile.netUpdate = true; + } + if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike && !modPlayer.vampiricTalisman) target.AddBuff(BuffType(), RottenDogtooth.ArmorCrunchDebuffTime); else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) @@ -5164,6 +5281,37 @@ namespace CalamityMod.Projectiles } #endregion + if (volatileGelatinSpawned) + { + Texture2D texture = TextureAssets.Projectile[projectile.type].Value; + float rate = (projectile.timeLeft * 0.05f); + List eColors = new List() + { + Color.SlateBlue, + Color.BlueViolet + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color finalColor = Color.Lerp(currentColor, nextColor, rate % 2f >= 1f ? 1f : rate % 1f); + + float fade = Utils.GetLerpValue(600, 700, projectile.timeLeft, true); + int draws = 12; + if (Main.player[projectile.owner].Calamity().volatileGelatinVisuals) + { + for (int i = 0; i < draws; i++) + { + float rotPoint = MathHelper.TwoPi / draws * i; + float dist = 1.5f * fade; + Main.EntitySpriteDraw(texture, projectile.Center - Main.screenPosition + rotPoint.ToRotationVector2().RotatedBy(Main.GlobalTimeWrappedHourly) * dist, null, finalColor with { A = 0 } * 0.6f * fade, MathF.Pow(projectile.rotation, 2), texture.Size() / 2f, projectile.scale * 1.2f, SpriteEffects.None); + } + } + + Main.EntitySpriteDraw(texture, projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, fade), projectile.rotation, texture.Size() / 2f, projectile.scale, SpriteEffects.None); + + shouldDrawBool = false; + } + if (projectile.type == ProjectileID.DeerclopsIceSpike && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { bool death = CalamityWorld.death || BossRushEvent.BossRushActive;