prowler fixes + gold shoal coin

This commit is contained in:
GinYuH committed 2024-08-02 20:16:43 -07:00
1 parent 4dfc0413f2
commit 5fbef67ecd
3 files changed
+40 -18

No files matched your search

+17
View File
@@ -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;
+9 -3
View File
@@ -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<Serpentine>(), 4);
public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot);
public static void DefineSandProwlerLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<Serpentine>(), 4);
}
public override void HitEffect(NPC.HitInfo hit)
{
+14 -15
View File
@@ -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<Serpentine>(), 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<ModGore>("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<SandProwler>());
Main.BestiaryTracker.Kills.RegisterKill(nPC);
}
}
}
}