From 89eb0f0e67e481f7734b2ddfa04da92b3d599f54 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:50:48 -0800 Subject: [PATCH] sea serpent -> sand prowler --- .../en-US/Mods.CalamityMod.NPCs.hjson | 3 +- NPCs/SunkenSea/SandProwler.cs | 494 ++++++++++++++++++ .../{SeaSerpent1.png => SandProwler1.png} | Bin .../{SeaSerpent2.png => SandProwler2.png} | Bin .../{SeaSerpent3.png => SandProwler3.png} | Bin .../{SeaSerpent4.png => SandProwler4.png} | Bin .../{SeaSerpent5.png => SandProwler5.png} | Bin .../{SeaSerpent6.png => SandProwler6.png} | Bin .../{SeaSerpent7.png => SandProwler7.png} | Bin .../{SeaSerpent8.png => SandProwler8.png} | Bin .../{SeaSerpent9.png => SandProwler9.png} | Bin .../{SeaSerpent1.cs => SandProwlerNested.cs} | 15 +- NPCs/SunkenSea/SeaSerpent2.cs | 151 ------ NPCs/SunkenSea/SeaSerpent3.cs | 149 ------ NPCs/SunkenSea/SeaSerpent4.cs | 149 ------ NPCs/SunkenSea/SeaSerpent5.cs | 149 ------ Tiles/MonsterBanner.cs | 2 +- Utilities/NPCDebuffs.cs | 7 +- 18 files changed, 505 insertions(+), 614 deletions(-) create mode 100644 NPCs/SunkenSea/SandProwler.cs rename NPCs/SunkenSea/{SeaSerpent1.png => SandProwler1.png} (100%) rename NPCs/SunkenSea/{SeaSerpent2.png => SandProwler2.png} (100%) rename NPCs/SunkenSea/{SeaSerpent3.png => SandProwler3.png} (100%) rename NPCs/SunkenSea/{SeaSerpent4.png => SandProwler4.png} (100%) rename NPCs/SunkenSea/{SeaSerpent5.png => SandProwler5.png} (100%) rename NPCs/SunkenSea/{SeaSerpent6.png => SandProwler6.png} (100%) rename NPCs/SunkenSea/{SeaSerpent7.png => SandProwler7.png} (100%) rename NPCs/SunkenSea/{SeaSerpent8.png => SandProwler8.png} (100%) rename NPCs/SunkenSea/{SeaSerpent9.png => SandProwler9.png} (100%) rename NPCs/SunkenSea/{SeaSerpent1.cs => SandProwlerNested.cs} (94%) delete mode 100644 NPCs/SunkenSea/SeaSerpent2.cs delete mode 100644 NPCs/SunkenSea/SeaSerpent3.cs delete mode 100644 NPCs/SunkenSea/SeaSerpent4.cs delete mode 100644 NPCs/SunkenSea/SeaSerpent5.cs diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 053a518f98..d21231805d 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -275,9 +275,10 @@ PearlpodPink.DisplayName: Pearlpod PearlpodWhite.DisplayName: Pearlpod PolypPanasea.DisplayName: Polyp Panasea PrismBack.DisplayName: Prism-Back +SandProwler.DisplayName: Sand Prowler +SandProwlerNested.DisplayName: Sand Prowler SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaSerpent1.DisplayName: Sea Serpent BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs new file mode 100644 index 0000000000..60de927dce --- /dev/null +++ b/NPCs/SunkenSea/SandProwler.cs @@ -0,0 +1,494 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SandProwler : ModNPC + { + public const int maxLength = 9; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + #region Textures + public static Texture2D BodySprite1; + public static Texture2D BodySprite2; + public static Texture2D BodySprite3; + public static Texture2D BodySprite4; + public static Texture2D BodySprite5; + public static Texture2D BodySprite6; + public static Texture2D BodySprite7; + public static Texture2D TailSprite; + #endregion + public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler1"; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + { + CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + if (!Main.dedServ) + { + BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.ImmediateLoad).Value; + BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.ImmediateLoad).Value; + BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.ImmediateLoad).Value; + BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.ImmediateLoad).Value; + BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.ImmediateLoad).Value; + BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.ImmediateLoad).Value; + BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.ImmediateLoad).Value; + TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.ImmediateLoad).Value; + } + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 30; + NPC.height = 24; + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + // only the head gets a healthbar + return NPC.ai[3] == 0; + } + + + public override void AI() + { + if (NPC.ai[3] == 0) + HeadAI(); + else + SegmentAI(); + } + public void HeadAI() + { + + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + if (NPC.ai[2] > 0f) + { + NPC.realLife = (int)NPC.ai[2]; + } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + { + NPC.TargetClosest(true); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 + int width = 18; + switch (segment) + { + case maxLength - 1: + spriteUse = 8; // Tail + break; + case maxLength - 2: + spriteUse = 7; // Body 7 + break; + case maxLength - 3: + spriteUse = 6; // Body 6 + width = 14; + break; + case maxLength - 4: + spriteUse = 5; // Body 5 + break; + case 0: + spriteUse = 1; // Body 1 + break; + case 1: + spriteUse = 2; // Body 2 + break; + } + Main.npc[lol].ai[3] = spriteUse; + Main.npc[lol].npcSlots = 0; + Main.npc[lol].dontCountMe = true; + Main.npc[lol].width = width; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + if (NPC.velocity.X < 0f) + { + NPC.spriteDirection = -1; + } + else if (NPC.velocity.X > 0f) + { + NPC.spriteDirection = 1; + } + if (Main.player[NPC.target].dead) + { + NPC.TargetClosest(false); + } + NPC.alpha -= 42; + if (NPC.alpha < 0) + { + NPC.alpha = 0; + } + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.active = false; + } + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + if (NPC.life > NPC.lifeMax * 0.99) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public void SegmentAI() + { + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); + + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float headDivisor = NPC.ai[3] == 1 ? (float)(Main.npc[(int)NPC.ai[1]].width / 2) : 1; + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + public override bool CheckActive() + { + return NPC.ai[3] == 0; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D segmentSprite = TextureAssets.Npc[Type].Value; + switch (NPC.ai[3]) + { + case 1: + segmentSprite = BodySprite1; + break; + case 2: + segmentSprite = BodySprite2; + break; + case 3: + segmentSprite = BodySprite3; + break; + case 4: + segmentSprite = BodySprite4; + break; + case 5: + segmentSprite = BodySprite5; + break; + case 6: + segmentSprite = BodySprite6; + break; + case 7: + segmentSprite = BodySprite7; + break; + case 8: + segmentSprite = TailSprite; + break; + } + SpriteEffects fx = NPC.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(segmentSprite, NPC.position - Main.screenPosition, null, NPC.GetAlpha(drawColor), NPC.rotation, segmentSprite.Size(), NPC.scale, fx, 0f); + return false; + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SandProwler1.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent1.png rename to NPCs/SunkenSea/SandProwler1.png diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SandProwler2.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent2.png rename to NPCs/SunkenSea/SandProwler2.png diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SandProwler3.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent3.png rename to NPCs/SunkenSea/SandProwler3.png diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SandProwler4.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent4.png rename to NPCs/SunkenSea/SandProwler4.png diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SandProwler5.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent5.png rename to NPCs/SunkenSea/SandProwler5.png diff --git a/NPCs/SunkenSea/SeaSerpent6.png b/NPCs/SunkenSea/SandProwler6.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent6.png rename to NPCs/SunkenSea/SandProwler6.png diff --git a/NPCs/SunkenSea/SeaSerpent7.png b/NPCs/SunkenSea/SandProwler7.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent7.png rename to NPCs/SunkenSea/SandProwler7.png diff --git a/NPCs/SunkenSea/SeaSerpent8.png b/NPCs/SunkenSea/SandProwler8.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent8.png rename to NPCs/SunkenSea/SandProwler8.png diff --git a/NPCs/SunkenSea/SeaSerpent9.png b/NPCs/SunkenSea/SandProwler9.png similarity index 100% rename from NPCs/SunkenSea/SeaSerpent9.png rename to NPCs/SunkenSea/SandProwler9.png diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SandProwlerNested.cs similarity index 94% rename from NPCs/SunkenSea/SeaSerpent1.cs rename to NPCs/SunkenSea/SandProwlerNested.cs index 56e9d374cb..2d2f4ffc6a 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -18,7 +18,7 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class SeaSerpent1 : ModNPC + public class SandProwlerNested : ModNPC { public bool PeekingOut; public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; @@ -49,6 +49,7 @@ namespace CalamityMod.NPCs.SunkenSea public ref float SnapCooldown => ref NPC.localAI[0]; public ref float InitialSnapDirection => ref NPC.localAI[1]; public ref float CurrentSnapDirection => ref NPC.localAI[2]; + public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler1"; public override void SetStaticDefaults() { @@ -300,14 +301,10 @@ namespace CalamityMod.NPCs.SunkenSea return false; Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D body1Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent2").Value; - Texture2D body2Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent3").Value; - Texture2D body3Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent4").Value; - Texture2D body4Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent5").Value; - Texture2D body5Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent6").Value; - Texture2D body6Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent7").Value; - Texture2D body7Texture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent8").Value; - Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/SeaSerpent9").Value; + Texture2D body1Texture = SandProwler.BodySprite1; + Texture2D body2Texture = SandProwler.BodySprite2; + Texture2D body3Texture = SandProwler.BodySprite3; + Texture2D body4Texture = SandProwler.BodySprite4; Vector2 idealDrawPosition = SpotToHideIn; Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs deleted file mode 100644 index 4334908959..0000000000 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent2 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs deleted file mode 100644 index 3258776809..0000000000 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent3 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs deleted file mode 100644 index 336e640558..0000000000 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent4 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 30; - NPC.width = 28; //42 - NPC.height = 24; //34 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs deleted file mode 100644 index 419b90c22f..0000000000 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent5 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 20; - NPC.width = 36; //42 - NPC.height = 30; //40 - NPC.defense = 30; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); - } - } - } - } -} diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 75470b3984..4432adf882 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -361,7 +361,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; case 108: npc = NPCType(); diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 4fdd449834..52b399875e 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -340,11 +340,8 @@ namespace CalamityMod { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss },