diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index b28c7f8f58..3f2cfc9766 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -87,6 +87,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Main.rand.NextBool(50)) { Variant = (int)ShoalColor.Gold; + NPC.catchItem = ItemID.GoldCoin; } RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); @@ -342,6 +343,22 @@ namespace CalamityMod.NPCs.SunkenSea } } + public override void OnCaughtBy(Player player, Item item, bool failed) + { + // Gold shoals drop Gold Coins instead of ash when caught + // The shoal drops 1 coin by default while the extra coins are spawned here in a spread + if (!failed) + { + if (Variant == (int)ShoalColor.Gold) + { + for (int i = 0; i < Main.rand.Next(0, 5); i++) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); + } + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index de2b390b52..38c002c8d3 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.SunkenSea { public class SandProwler : ModNPC { - public const int maxLength = 9; + public const int maxLength = 14; public float speed = 3f; public float turnSpeed = 0.0625f; bool TailSpawned = false; @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", PortraitPositionXOverride = 40, @@ -549,12 +549,18 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } + public override bool CheckActive() { return IsHead; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); + + public static void DefineSandProwlerLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 4); + } public override void HitEffect(NPC.HitInfo hit) { diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs index e33c3c3b3e..12ae5ed946 100644 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -16,6 +16,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.GameContent.Bestiary; +using CalamityMod.NPCs.Crags; namespace CalamityMod.NPCs.SunkenSea { @@ -54,16 +55,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - + this.HideFromBestiary(); NPCID.Sets.TrailingMode[NPC.type] = 0; NPCID.Sets.TrailCacheLength[NPC.type] = 60; NPCID.Sets.UsesNewTargetting[NPC.type] = true; @@ -274,7 +266,7 @@ namespace CalamityMod.NPCs.SunkenSea if (SnapTimer > 0f) { int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 8f; + float idealSpeed = PeekingOut ? 1.75f : 10f; float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; @@ -461,10 +453,7 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 4); - } + public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); public override void HitEffect(NPC.HitInfo hit) { @@ -481,5 +470,15 @@ namespace CalamityMod.NPCs.SunkenSea Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); } } + public override void OnKill() + { + // Increase the kill count of Sand Prowlers for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } + } } }