diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs index c297680605..d77450e6d5 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs @@ -1,10 +1,17 @@ -using CalamityMod.CalPlayer; +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; @@ -12,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelEmerald : ModNPC { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewelEmerald"; private const int ChargePhaseGateValue = 120; private const int ChargeGateValue = 60; @@ -49,7 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -122,6 +129,13 @@ namespace CalamityMod.NPCs.NormalNPCs // 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)) { @@ -216,17 +230,46 @@ namespace CalamityMod.NPCs.NormalNPCs } } + 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 - Main.screenPosition, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - Main.screenPosition, 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 initialColor = new Color(100, 175, 100); - Color newColor = initialColor; - Color finalColor = new Color(150, 255, 150); - float colorTelegraphGateValue = (CalamityWorld.death ? ChargeGateValue_Death : ChargeGateValue) - LightTelegraphDuration; - if (NPC.ai[1] > colorTelegraphGateValue) - newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[1] - colorTelegraphGateValue) / LightTelegraphDuration); - newColor.A = (byte)(255 * NPC.Opacity); - - return newColor; + return Color.White; } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.png b/NPCs/NormalNPCs/KingSlimeJewelEmerald.png new file mode 100644 index 0000000000..ce97f974b7 Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelEmerald.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelFlash.png b/NPCs/NormalNPCs/KingSlimeJewelFlash.png new file mode 100644 index 0000000000..86950b1323 Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelFlash.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 4124af61d1..47a8b164c6 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -1,18 +1,27 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.Runtime.InteropServices; +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; +using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelRuby : ModNPC { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; + public static readonly SoundStyle ShatterSound = new SoundStyle("CalamityMod/Sounds/NPCKilled/CrownJewelShatter"); + public static readonly SoundStyle ShootSound = new SoundStyle("CalamityMod/Sounds/Custom/RedJewelFire"); private const int BoltShootGateValue = 60; private const int BoltShootGateValue_Death = 75; @@ -46,11 +55,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + // Despawn if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -131,21 +141,13 @@ namespace CalamityMod.NPCs.NormalNPCs projVector.X *= projLength; projVector.Y *= projLength; - for (int dusty = 0; dusty < 10; dusty++) + for (int i = 0; i < 6; i++) { - Vector2 dustVel = projVector; - dustVel.Normalize(); - int ruby = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemRuby, dustVel.X, dustVel.Y, 100, default, 2f); - Main.dust[ruby].velocity *= 1.5f; - Main.dust[ruby].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[ruby].scale = 0.5f; - Main.dust[ruby].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + 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(SoundID.Item8, NPC.Center); + SoundEngine.PlaySound(ShootSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -168,17 +170,46 @@ namespace CalamityMod.NPCs.NormalNPCs } } + 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.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)); + } + + 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; + + float alph = 0f; + + float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) - 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 - Main.screenPosition, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - Main.screenPosition, 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(175, 100, 100); - Color newColor = initialColor; - Color finalColor = new Color(255, 150, 150); - float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration; - if (NPC.ai[0] > colorTelegraphGateValue) - newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); - newColor.A = (byte)(255 * NPC.Opacity); - - return newColor; + return Color.White; } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) @@ -190,37 +221,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void HitEffect(NPC.HitInfo hit) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, hit.HitDirection, -1f, 0, default, 1f); - Main.dust[dust].noGravity = true; - - if (NPC.life <= 0) + for (int i = 0; i < 6; i++) { - 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.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust].velocity *= 3f; - 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; - } - } - - for (int j = 0; j < 10; j++) - { - int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 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.GemRuby, 0f, 0f, 100, default, 2f); - Main.dust[rubyDust2].noGravity = true; - Main.dust[rubyDust2].velocity *= 2f; - } + 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)); } } } diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.png b/NPCs/NormalNPCs/KingSlimeJewelRuby.png new file mode 100644 index 0000000000..f94f29c1af Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelRuby.png differ diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs b/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs index 01939954f6..48f3531a86 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelSapphire.cs @@ -1,11 +1,17 @@ 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; @@ -13,8 +19,6 @@ namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewelSapphire : ModNPC { - public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel"; - private const int BuffDustGateValue = 60; private const float LightTelegraphDuration = 45f; @@ -49,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!CalamityPlayer.areThereAnyDamnBosses) { NPC.life = 0; - NPC.HitEffect(); + OnKill(); NPC.active = false; NPC.netUpdate = true; return; @@ -184,6 +188,24 @@ namespace CalamityMod.NPCs.NormalNPCs } } + 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 - Main.screenPosition, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex2.Value, NPC.Center - Main.screenPosition, 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); @@ -202,6 +224,22 @@ namespace CalamityMod.NPCs.NormalNPCs 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) diff --git a/NPCs/NormalNPCs/KingSlimeJewelSapphire.png b/NPCs/NormalNPCs/KingSlimeJewelSapphire.png new file mode 100644 index 0000000000..275d2722fa Binary files /dev/null and b/NPCs/NormalNPCs/KingSlimeJewelSapphire.png differ diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index c5cd9513ad..364c80c77e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -13,6 +13,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class KingSlimeAI { + public static readonly SoundStyle SpawnCrystalSound = new SoundStyle("CalamityMod/Sounds/Custom/KingSlimeJewelSpawn"); + public static bool BuffedKingSlimeAI(NPC npc, Mod mod) { // Percent life remaining @@ -102,10 +104,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + 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; + } } if (phase3 && npc.Calamity().newAI[0] == 1f) @@ -126,10 +132,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + 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) @@ -150,10 +160,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + 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; + } } } else @@ -177,10 +191,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - SoundEngine.PlaySound(SoundID.Item38, vector); + SoundEngine.PlaySound(SpawnCrystalSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); + { + 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; + } } } diff --git a/Particles/CustomSprite.cs b/Particles/CustomSprite.cs new file mode 100644 index 0000000000..bdf4de1bcf --- /dev/null +++ b/Particles/CustomSprite.cs @@ -0,0 +1,79 @@ +using System; +using System.Threading; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.Projectiles.Rogue.FinalDawnFlame; + +namespace CalamityMod.Particles +{ + public class CustomSprite : Particle + { + bool addBlend = false; + bool important = false; + bool AffectedByGravity = false; + + string Tex = ""; + int frames = 1; + int currentFrame = 1; + + int Timer = 0; + + float maxGravity = 0f; + + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + public override bool Important => important; + public override string Texture => "CalamityMod/Particles/CuteStars"; + public override int FrameVariants => frames; + + public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, string tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 1, int frame = 0) + { + maxGravity = grav; + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + addBlend = AddativeBlend; + important = needed; + Color = color; + Tex = tex; + frames = frameCount; + currentFrame = frame; + } + + public override void Update() + { + Position += Velocity; + + Timer++; + + if (Timer > Lifetime - 20) + { + Scale *= 0.9f; + } + + Velocity *= 0.85f; + if (maxGravity != 0f) + { + if (Velocity.Length() < maxGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += maxGravity / 10f; + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Asset tex = ModContent.Request(Tex); + + Rectangle fr = tex.Frame(1, frames, 0, currentFrame); + + Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Scale), Rotation, new Vector2(tex.Width() * 0.5f, tex.Height() / frames * 0.5f), 1f, SpriteEffects.None); + } + } +} diff --git a/Particles/KingSlimeEmeraldShards.png b/Particles/KingSlimeEmeraldShards.png new file mode 100644 index 0000000000..f16784085c Binary files /dev/null and b/Particles/KingSlimeEmeraldShards.png differ diff --git a/Particles/KingSlimeRubyShards.png b/Particles/KingSlimeRubyShards.png new file mode 100644 index 0000000000..e25207c646 Binary files /dev/null and b/Particles/KingSlimeRubyShards.png differ diff --git a/Particles/KingSlimeSapphireShards.png b/Particles/KingSlimeSapphireShards.png new file mode 100644 index 0000000000..9145e3d5a8 Binary files /dev/null and b/Particles/KingSlimeSapphireShards.png differ diff --git a/Sounds/Custom/KingSlimeJewelSpawn.ogg b/Sounds/Custom/KingSlimeJewelSpawn.ogg new file mode 100644 index 0000000000..d3cf2ee7cc Binary files /dev/null and b/Sounds/Custom/KingSlimeJewelSpawn.ogg differ diff --git a/Sounds/Custom/RedJewelFire.ogg b/Sounds/Custom/RedJewelFire.ogg new file mode 100644 index 0000000000..5df8b03733 Binary files /dev/null and b/Sounds/Custom/RedJewelFire.ogg differ diff --git a/Sounds/NPCKilled/CrownJewelShatter.ogg b/Sounds/NPCKilled/CrownJewelShatter.ogg new file mode 100644 index 0000000000..daf9d97177 Binary files /dev/null and b/Sounds/NPCKilled/CrownJewelShatter.ogg differ