From c09d3addfd789b6eaf6fd39c41819a3c726fde6e Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:58:15 -0800 Subject: [PATCH] Reworked Baby Ghost Bell --- NPCs/SunkenSea/BabyGhostBell.cs | 64 ++++++++++++++++++++++++++------- NPCs/SunkenSea/LostShoal.cs | 3 +- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index ac5a823cf3..bec3ed4061 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,13 +1,16 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -155,23 +158,60 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); + // Quick lil hops in random directions for movement if (NPC.wet) { - NPC.noGravity = true; - if (NPC.velocity.Y < 0f) + NPC.height = (int)(36 * NPC.scale); + if (NPC.velocity.Length() < 0.25f) { - NPC.velocity.Y += 0.1f; - } - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = 0f; + Vector2 direction = Main.rand.NextVector2Circular(30, 30); + direction.Normalize(); + NPC.velocity = direction * 4; } + NPC.velocity *= 0.95f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); } else { - NPC.noGravity = false; + // Height is changed so that the jelly looks like it's actually laying on the ground when rotated + NPC.height = (int)(24 * NPC.scale); + // Gravy + if (NPC.velocity.Y < 10) + { + NPC.velocity.Y += 0.5f; + } + // Once it has hit the ground, fall over + if (Math.Abs(NPC.velocity.Y) < 1 && NPC.collideY) + { + // Splat + if (NPC.ai[2] == 0) + { + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, NPC.Center); + NPC.ai[2] = 1; + } + NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.7f); + } + // Reset the splat sound + else + { + NPC.ai[2] = 0; + } } + // Lite + Color lightColor = Color.LightBlue; // Voltaic uses the same light blue + switch (Variant) + { + case (int)JellyColor.Red: + lightColor = Color.Pink; + break; + case (int)JellyColor.Green: + lightColor = Color.LightGreen; + break; + case (int)JellyColor.Radiant: + lightColor = Color.LightBlue * 1.1f; // Radiant glows brighter + break; + } + Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); } public override bool? CanBeHitByProjectile(Projectile projectile) @@ -246,9 +286,9 @@ namespace CalamityMod.NPCs.SunkenSea texture = VoltaicTexture; break; } - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index d9bf099737..6c4805332f 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -40,6 +40,7 @@ namespace CalamityMod.NPCs.SunkenSea RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalRed", AssetRequestMode.ImmediateLoad).Value; BlueTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalBlue", AssetRequestMode.ImmediateLoad).Value; } + NPCID.Sets.CountsAsCritter[NPC.type] = true; } public override void SetDefaults() { @@ -59,7 +60,7 @@ namespace CalamityMod.NPCs.SunkenSea //Banner = NPC.type; //BannerItem = ModContent.ItemType(); NPC.chaseable = false; - NPC.catchItem = ItemID.AshBlock; + NPC.catchItem = ItemID.AshBlock; // yeah this is intentional NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = false;