diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png new file mode 100644 index 0000000000..8becc53bd0 Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore1.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png new file mode 100644 index 0000000000..833c94b601 Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore2.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png new file mode 100644 index 0000000000..a4c5766fdb Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore3.png differ diff --git a/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png new file mode 100644 index 0000000000..2002e2a9ee Binary files /dev/null and b/Gores/SunkenSea/BlindedAngler/BlindAnglerGore4.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png new file mode 100644 index 0000000000..828fc5cab8 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore1.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png new file mode 100644 index 0000000000..e34333cc3a Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore2.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png new file mode 100644 index 0000000000..0835dffcf4 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore3.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png new file mode 100644 index 0000000000..fc0b44b6b2 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore4.png differ diff --git a/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png new file mode 100644 index 0000000000..c39cf01434 Binary files /dev/null and b/Gores/SunkenSea/SeaSerpent/SeaSerpentGore5.png differ diff --git a/Items/Critters/SeaFloatyItem.cs b/Items/Critters/SeaFloatyItem.cs deleted file mode 100644 index b313de7f03..0000000000 --- a/Items/Critters/SeaFloatyItem.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SeaFloatyItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.value = Item.sellPrice(gold: 3); // These things are actually painful to catch, they can get a 300% value boost - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaFloatyItem.png b/Items/Critters/SeaFloatyItem.png deleted file mode 100644 index 83dc6f5920..0000000000 Binary files a/Items/Critters/SeaFloatyItem.png and /dev/null differ diff --git a/Items/Critters/SeaMinnowGoldItem.cs b/Items/Critters/SeaMinnowGoldItem.cs deleted file mode 100644 index d0ee9d3bf7..0000000000 --- a/Items/Critters/SeaMinnowGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Critters -{ - public class SeaMinnowGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/SeaMinnowGoldItem.png b/Items/Critters/SeaMinnowGoldItem.png deleted file mode 100644 index 95f0da795b..0000000000 Binary files a/Items/Critters/SeaMinnowGoldItem.png and /dev/null differ diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.cs b/Items/Placeables/Banners/BlindedAnglerBanner.cs new file mode 100644 index 0000000000..a8cd03e747 --- /dev/null +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class BlindedAnglerBanner : BaseBanner + { + public override int BannerTileStyle => 104; + } +} diff --git a/Items/Placeables/Banners/BlindedAnglerBanner.png b/Items/Placeables/Banners/BlindedAnglerBanner.png new file mode 100644 index 0000000000..6f56ac9128 Binary files /dev/null and b/Items/Placeables/Banners/BlindedAnglerBanner.png differ diff --git a/Items/Placeables/Banners/PodobooKoiBanner.cs b/Items/Placeables/Banners/PodobooKoiBanner.cs deleted file mode 100644 index 14ac5680a0..0000000000 --- a/Items/Placeables/Banners/PodobooKoiBanner.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace CalamityMod.Items.Placeables.Banners -{ - public class PodobooKoiBanner : BaseBanner - { - public override int BannerTileStyle => 143; - } -} diff --git a/Items/Placeables/Banners/PodobooKoiBanner.png b/Items/Placeables/Banners/PodobooKoiBanner.png deleted file mode 100644 index c2b67aa9cc..0000000000 Binary files a/Items/Placeables/Banners/PodobooKoiBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SandProwlerBanner.cs b/Items/Placeables/Banners/SandProwlerBanner.cs deleted file mode 100644 index 9fef623265..0000000000 --- a/Items/Placeables/Banners/SandProwlerBanner.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Banners -{ - [LegacyName("SeaSerpentBanner")] - public class SandProwlerBanner : BaseBanner - { - public override int BannerTileStyle => 106; - } -} diff --git a/Items/Placeables/Banners/SandProwlerBanner.png b/Items/Placeables/Banners/SandProwlerBanner.png deleted file mode 100644 index c440619fe1..0000000000 Binary files a/Items/Placeables/Banners/SandProwlerBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/SeaSerpentBanner.cs b/Items/Placeables/Banners/SeaSerpentBanner.cs new file mode 100644 index 0000000000..ef12cc3ebc --- /dev/null +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SeaSerpentBanner : BaseBanner + { + public override int BannerTileStyle => 106; + } +} diff --git a/Items/Placeables/Banners/SeaSerpentBanner.png b/Items/Placeables/Banners/SeaSerpentBanner.png new file mode 100644 index 0000000000..e384093d74 Binary files /dev/null and b/Items/Placeables/Banners/SeaSerpentBanner.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 14ccd7fddf..9fa728f37f 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -117,6 +117,7 @@ Toxicatfish: Though these fish once threatened none other than their prey, the r Trasher: Despite being equipped with a mouth large enough to swallow a child whole, these crocodiles simply act as scavengers, devouring scraps and bones left over from predators' meals. Needing to conserve energy due to eating relatively little, they rarely move at their full speed unless they feel threatened. //Sunken Sea Enemies BabyGhostBell: Despite their decidedly lower size and development, infant Ghost Bells can deliver just as many volts to unsuspecting creatures. The Ilmerian army bred thousands of Ghost Bells to maintain the lethal electric field around the sea kingdom, but all their efforts were consumed by ash in a single burning moment. +BlindedAngler: Lacking most normal senses, these predators use a form of biological sonar to 'see' their surroundings. The glowing crystals on their backs draw in prey that use the sea's shimmering prisms as their guiding light, like a moth to the flame. CarrionSwallower: Of all the species of fish rendered extinct by the Great Incineration, few were lucky enough to even have their corpses remain in one piece. Those that did had their souls infused with trace amounts of brimstone, which they use to hunt any that dare trespass on the old sea. Clam: Despite having the same filter feeder appetite of the common clam, the Ilmeran species adopted defensive mechanisms against macrofauna due to their forced relocation by the Incineration. Almost all of the remaining Clams have congregated in a small den at the bottom of the sea; what makes this place unique is unknown, as few divers can withstand the ferocity of the clams in their natural abode. Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, Cnidrions fought valiantly alongside their masters during the Incineration. Though many perished unceremoniously with the warriors that commanded them, one managed to escape a fiery demise, continuing to defend what was once the heart of the sea kingdom with a fierce loyalty. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 6295eba031..f86642b5ed 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -19,6 +19,7 @@ BabyCannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerNa BabyFlakCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BabyGhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BelchingCoralBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BlindedAnglerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BloatfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BloomSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BobbitWormBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -26,7 +27,6 @@ BohldohrBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" BoxJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CalamityEyeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CannonballJellyfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -CarrionSwallowerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ChaoticPufferBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" CladCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ClamBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -55,22 +55,15 @@ FusionFeederBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GammaSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GhostBellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GiantSquidBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -GildedAxolotlBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GnasherBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" GulperEelBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HadarianBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -HauntedChumBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" HeatSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IceClasperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ImpiousImmolatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" InfernalCongealmentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" IrradiatedSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -JellyghoulBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -KelpieSeadragonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LaserfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LazarusLampfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LeerslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -LostShoalBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" LuminousCorvinaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" MantisShrimpBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -82,7 +75,6 @@ NuclearToadBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OarfishBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OrthoceraBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" OverloadedSoldierBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PearlpodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PerennialSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PestilentSlimeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PhantomSpiritBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -90,11 +82,7 @@ PiggyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlaguebringerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueChargerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueshellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PodobooKoiBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PolyperilBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PrismBackBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -PrismaticGuppyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ProbesnoutBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ProfanedEnergyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RadiatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ReaperSharkBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -103,28 +91,21 @@ RepairUnitBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RimehoundBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RotdogBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RubyCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SandProwlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SeaSerpentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SapphireCrawlerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ScavengerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScornEaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ScryllarBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaFloatyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SearslugBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SharkoonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShockstormShuttleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ShoreskipperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShroombleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerColliderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerSpitterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SkyfinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SlabCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SlugbunBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SoulSlurperBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -SteampodBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StellarCulexBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" StormlionBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -StormlionSentryBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulflounderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SulphurousSkaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SunskaterBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index ecc16a2a2b..92a225febc 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -258,20 +258,17 @@ Sulflounder.DisplayName: Sulflounder Toxicatfish.DisplayName: Toxicatfish Trasher.DisplayName: Trasher BabyGhostBell.DisplayName: Baby Ghost Bell +BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas -GoldBabyGhostBell: Gold Baby Ghost Bell PrismBack.DisplayName: Prism-Back -RadiantBabyGhostBell: Radiant Baby Ghost Bell -SandProwler.DisplayName: Sand Prowler -SandProwlerNested.DisplayName: Sand Prowler SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaMinnowGold.DisplayName: Gold Sea Minnow +SeaSerpent1.DisplayName: Sea Serpent BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker diff --git a/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs index edb77ef352..f900b7189e 100644 --- a/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs +++ b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs @@ -663,7 +663,7 @@ namespace CalamityMod.NPCs.NormalNPCs } // Sea Minnows face away from the player - if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) npc.direction *= -1; } else diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs new file mode 100644 index 0000000000..7d43671bd6 --- /dev/null +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -0,0 +1,150 @@ +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +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 BlindedAngler : ModNPC + { + public static Asset GlowTexture; + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 150; + NPC.width = 56; + NPC.height = 44; + NPC.defense = 30; + NPC.lifeMax = 750; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + 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.BlindedAngler") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 1, 100f, 0.1f, 0.1f, 3f, 3f, 0.1f); + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += (NPC.wet || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector = center - screenPos; + vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; + vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); + Main.spriteBatch.Draw(GlowTexture.Value, vector, + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + { + return NPC.chaseable; + } + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.45f; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 5, 9); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore4").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/BlindedAngler.png b/NPCs/SunkenSea/BlindedAngler.png new file mode 100644 index 0000000000..afdae09734 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAngler.png differ diff --git a/NPCs/SunkenSea/BlindedAnglerGlow.png b/NPCs/SunkenSea/BlindedAnglerGlow.png new file mode 100644 index 0000000000..c38e496699 Binary files /dev/null and b/NPCs/SunkenSea/BlindedAnglerGlow.png differ diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 1607173c7f..11e0c19ab5 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -1,7 +1,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.GameContent.Bestiary; diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 9c3f8826bc..7a077f0067 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -4,7 +4,6 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs deleted file mode 100644 index 576d3809fc..0000000000 --- a/NPCs/SunkenSea/SandProwler.cs +++ /dev/null @@ -1,724 +0,0 @@ -using CalamityMod.Enums; -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 System.Collections.Generic; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwler : SunkenSeaNPC - { - public const int maxLength = 14; - public float speed = 3f; - public float turnSpeed = 0.0625f; - bool TailSpawned = false; - #region Textures - public static Asset BodySprite1; - public static Asset BodySprite2; - public static Asset BodySprite3; - public static Asset BodySprite4; - public static Asset BodySprite5; - public static Asset BodySprite6; - public static Asset BodySprite7; - public static Asset TailSprite; - #endregion - - public enum AnimType - { - None = 0, - Blink = 1, - Bite = 2 - } - - public bool IsHead => NPC.ai[3] == 0; - - public bool IsTail => NPC.ai[3] == 8; - - public ref float CurrentAnimation => ref NPC.localAI[1]; - - public ref float CurrentFrame => ref NPC.localAI[0]; - - public ref float BlinkTimer => ref NPC.localAI[2]; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back - if (!Main.dedServ) - { - BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); - BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); - BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); - BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); - BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); - BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); - BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); - TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); - } - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - base.SetDefaults(); - NPC.damage = 50; - NPC.width = 30; - NPC.height = 24; - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.chaseable = false; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - NPC.waterMovementSpeed = 1; - NPC.GravityIgnoresLiquid = true; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler") - }); - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - // only the head gets a healthbar - return IsHead; - } - - - public override void AI() - { - if (IsHead) - 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, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - 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 - width = 14 ; - break; - case maxLength - 3: - spriteUse = 6; // Body 6 - width = 16; - 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); - Entity targ = CurrentPrey != null ? CurrentPrey : Main.player[NPC.target]; - float targetXDist = targ.position.X + (float)(targ.width / 2); - float targetYDist = targ.position.Y + (float)(targ.height / 2); - bool coinTarget = false; - // fucking run if it notices a predator - if (CurrentPredator != null) - { - Vector2 dirToPred = NPC.DirectionTo(CurrentPredator.Center); - targetXDist = -dirToPred.X * 300; - targetYDist = -dirToPred.Y * 300; - currentSpeed *= 2f; - currentTurnSpeed *= 11.5f; - } - else - { - // Look for silver and gold coins to eat - for (int i = 0; i < Main.maxItems; i++) - { - Item item = Main.item[i]; - // continue if not an active silver or gold coin - if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) - continue; - // can only look for coins in a 75 tile radius - if (item.Distance(NPC.Center) > 1200) - continue; - // if its head touches the coin, eat it - if (item.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - item.active = false; - break; - } - // if it isn't touching the coin, go to it - targetXDist = item.Center.X; - targetYDist = item.Center.Y; - coinTarget = true; - break; - } - } - // aggro on coins takes priority over players - if (CurrentPredator == null && (NPC.life > NPC.lifeMax * 0.99 && targ is Player) && !coinTarget) - { - 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; - } - } - - // Blink every so often - if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) - { - CurrentAnimation = (int)AnimType.Blink; - BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; - } - } - else if (CurrentPredator == null) - { - 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 (targetDistance < 128 && targ is NPC || (NPC.life <= NPC.lifeMax * 0.99 && targ is Player) || coinTarget) - { - CurrentAnimation = (int)AnimType.Bite; - } - else if (CurrentAnimation != (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - BlinkTimer--; - if (BlinkTimer <= 0) - { - BlinkTimer = 0; - if (CurrentAnimation == (int)AnimType.Blink) - { - CurrentAnimation = (int)AnimType.None; - } - } - 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() - { - 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() && Main.npc[i].ai[3] == 0) - { - 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 = 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 void FindFrame(int frameHeight) - { - if (IsTail) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.localAI[0]++; - NPC.frameCounter = 0; - } - if (NPC.localAI[0] > 7) - { - NPC.localAI[0] = 0; - } - } - if (IsHead) - { - NPC.frameCounter++; - if (NPC.frameCounter > 6) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0; - } - switch (CurrentAnimation) - { - case (int)AnimType.None: - NPC.frame.Y = 0; - break; - case (int)AnimType.Bite: - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - break; - case (int)AnimType.Blink: - if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) - { - NPC.frame.Y = frameHeight; - } - break; - } - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZonePolypForest && 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 IsHead; - } - - protected override bool NPCSearchFilter(NPC n) - { - float huntRange = 600f; - float avoidRange = 200f; - bool preyFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < huntRange * huntRange && PreyIDs.Contains(n.type); - bool predFilter = Vector2.DistanceSquared(NPC.Center, n.Center) < avoidRange * avoidRange && PredatorIDs.Contains(n.type); - bool hidingGuppy = n.type == ModContent.NPCType() && n.alpha > 0; - return !hidingGuppy && (preyFilter || predFilter); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitNPC(NPC target) - { - return IsHead; - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - if (IsHead) - NPC.chaseable = true; - else - Main.npc[NPC.realLife].chaseable = true; - } - - 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) - { - 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.dedServ) - { - 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; - if (NPC.IsABestiaryIconDummy) - { - NPC.frame = segmentSprite.Frame(); - // Buffers the segment position and rotations - float offset = -0.2f; - float startX = 0; - float startY = 0; - int segmentSpacing = 16; - int animationSpeed = 5; - float wormTimer = NPC.Calamity().bestiaryWormTimer; - // Draw the body segments - for (int i = 7; i > 0; i--) - { - // The first segment is slightly closer to keep up with the head - float bodyOffset = i == 1 ? i * segmentSpacing * 0.4f : i * segmentSpacing - segmentSpacing * 0.5f; - - Texture2D toUse = i == 1 ? BodySprite1.Value : i == 2 ? BodySprite2.Value : i % 2 == 0 ? BodySprite3.Value : BodySprite4.Value; - spriteBatch.Draw(toUse, NPC.position + new Vector2(startX + bodyOffset, MathF.Sin((wormTimer + offset * i) * animationSpeed) * 2 + startY), toUse.Frame(1, 1, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos((wormTimer + offset * i) * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(toUse.Width / 2, toUse.Width / 2), NPC.scale, SpriteEffects.None, 0f); - } - // Draw the head - spriteBatch.Draw(segmentSprite, NPC.position + new Vector2(startX, MathF.Sin(wormTimer * animationSpeed) * 2 + startY), segmentSprite.Frame(1, 11, 0, 0), NPC.GetAlpha(drawColor), NPC.rotation - MathHelper.PiOver2 - MathF.Cos(wormTimer * animationSpeed) * MathHelper.PiOver4 * 0.075f, new Vector2(segmentSprite.Width * 0.5f, segmentSprite.Height / 11), NPC.scale, SpriteEffects.None, 0f); - - return false; - } - switch (NPC.ai[3]) - { - case 0: - break; - case 1: - segmentSprite = BodySprite1.Value; - break; - case 2: - segmentSprite = BodySprite2.Value; - break; - case 3: - segmentSprite = BodySprite3.Value; - break; - case 4: - segmentSprite = BodySprite4.Value; - break; - case 5: - segmentSprite = BodySprite5.Value; - break; - case 6: - segmentSprite = BodySprite6.Value; - break; - case 7: - segmentSprite = BodySprite7.Value; - break; - case 8: - segmentSprite = TailSprite.Value; - break; - default: - segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; - break; - } - float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; - Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); - Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); - if (IsHead) - { - frame = NPC.frame; - } - else if (IsTail) - { - frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); - } - spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); - return false; - } - } -} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png deleted file mode 100644 index a36c31ffbb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png deleted file mode 100644 index bb3fe551b5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler2.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png deleted file mode 100644 index 7a33532959..0000000000 Binary files a/NPCs/SunkenSea/SandProwler3.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png deleted file mode 100644 index 8588ffaa7e..0000000000 Binary files a/NPCs/SunkenSea/SandProwler4.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png deleted file mode 100644 index c1b0777eeb..0000000000 Binary files a/NPCs/SunkenSea/SandProwler5.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler6.png b/NPCs/SunkenSea/SandProwler6.png deleted file mode 100644 index b9304a7630..0000000000 Binary files a/NPCs/SunkenSea/SandProwler6.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler7.png b/NPCs/SunkenSea/SandProwler7.png deleted file mode 100644 index bbed0cae7f..0000000000 Binary files a/NPCs/SunkenSea/SandProwler7.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png deleted file mode 100644 index c722b5e8f5..0000000000 Binary files a/NPCs/SunkenSea/SandProwler8.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwler9.png b/NPCs/SunkenSea/SandProwler9.png deleted file mode 100644 index 594b3586ae..0000000000 Binary files a/NPCs/SunkenSea/SandProwler9.png and /dev/null differ diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs deleted file mode 100644 index 8a95c7e615..0000000000 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ /dev/null @@ -1,504 +0,0 @@ -using CalamityMod.DataStructures; -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -using Terraria.GameContent.Bestiary; -using CalamityMod.Enums; - -namespace CalamityMod.NPCs.SunkenSea -{ - public class SandProwlerNested : SunkenSeaNPC - { - public bool PeekingOut; - public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; - public Point TileCoordsToHideIn - { - get => SpotToHideIn.ToTileCoordinates(); - set => SpotToHideIn = value.ToWorldCoordinates(); - } - public Vector2 SpotToHideIn - { - get => new Vector2(NPC.ai[0], NPC.ai[1]); - set - { - NPC.ai[0] = value.X; - NPC.ai[1] = value.Y; - } - } - - public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); - - public bool RetreatingToHidingSpot - { - get => NPC.ai[2] == 1f; - set => NPC.ai[2] = value.ToInt(); - } - - public ref float SnapTimer => ref NPC.ai[3]; - 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/SandProwler"; - protected override List PreyIDs => new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - }; - - protected override List PredatorIDs => new List() - { - ModContent.NPCType() - }; - - protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - NPCID.Sets.TrailingMode[Type] = 0; - NPCID.Sets.TrailCacheLength[Type] = 60; - NPCID.Sets.UsesNewTargetting[Type] = true; - NPCID.Sets.CantTakeLunchMoney[Type] = true; - Main.npcFrameCount[Type] = 11; - base.SetStaticDefaults(); - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 30; - NPC.height = 30; //32 - NPC.defense = 10; - NPC.lifeMax = 300; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(silver: 20); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.chaseable = false; - NPC.netAlways = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - NPC.waterMovementSpeed = 1f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(PeekingOut); - writer.Write(SnapCooldown); - writer.Write(InitialSnapDirection); - writer.Write(CurrentSnapDirection); - writer.Write(NPC.Calamity().newAI[1]); - writer.Write(NPC.chaseable); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - PeekingOut = reader.ReadBoolean(); - SnapCooldown = reader.ReadSingle(); - InitialSnapDirection = reader.ReadSingle(); - CurrentSnapDirection = reader.ReadSingle(); - NPC.Calamity().newAI[1] = reader.ReadSingle(); - NPC.chaseable = reader.ReadBoolean(); - } - - public override void AI() - { - // Choose an initial tile to hide in. - if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) - { - int tries; - for (tries = 0; tries < 1800; tries++) - { - int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); - int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - - // Try again if the tile isn't solid or isn't exposed to air. - if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) - continue; - - // Try again if there's no open water near the tile. - Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); - Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; - float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; - if (collisionDistance <= 10) - continue; - - TileCoordsToHideIn = new Point(x, y); - break; - } - - // Just die if no spot was suitable. - if (tries >= 1799) - NPC.active = false; - - NPC.Center = SpotToHideIn; - NPC.netUpdate = true; - } - - Entity target = null; - - // Look for coins - for (int i = 0; i < Main.maxItems; i++) - { - Item n = Main.item[i]; - if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) - continue; - // if its head touches the coin, eat it - if (n.getRect().Intersects(NPC.getRect())) - { - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); - SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); - int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; - for (int j = 0; j < 4; j++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - } - n.active = false; - break; - } - // Set the coin as the target - if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) - { - target = n; - } - } - // Go after sea minnows if not distracted by shiny coin - if (target == null) - { - if (NPC.life > NPC.lifeMax * 0.99f) - { - if (CurrentPrey != null) - target = CurrentPrey; - } - // If you've pissed it off, it now goes after YOU - else - { - NPC.TargetClosest(false); - target = Main.player[NPC.target]; - } - } - - // Open mouth when launching towards a target - if (SnapTimer > 0 && target != null && !PeekingOut) - { - NPC.Calamity().newAI[1] = 1; - } - else if (RetreatingToHidingSpot || InHidingSpot) - { - NPC.Calamity().newAI[1] = 0; - } - - // Become invulnerable and mostly transparent if hiding in a tile. - NPC.dontTakeDamage = InHidingSpot; - NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); - - // Also emit some particle effects as an indicator. - if (InHidingSpot) - { - Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, DustID.AncientLight); - sparkle.color = Color.Orange; - sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); - sparkle.noGravity = true; - } - - // Decide rotation. - NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; - - // Prevent the tile from being destroyed. - FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); - - // Do nothing other than hiding if instructed to do so. - if (RetreatingToHidingSpot) - { - NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; - NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; - - // Stop once the hiding spot has been reached. - if (InHidingSpot) - { - NPC.Center = SpotToHideIn; - NPC.velocity = Vector2.Zero; - RetreatingToHidingSpot = false; - NPC.netUpdate = true; - } - - return; - } - - // Don't do any snapping and such if the cooldown is active. - if (SnapCooldown > 0f) - { - SnapCooldown--; - if (SnapCooldown <= 0f) - NPC.netUpdate = true; - return; - } - - if (SnapTimer > 0f) - { - int snapTime = PeekingOut ? 45 : 32; - float idealSpeed = PeekingOut ? 1.75f : 10f; - float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); - NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; - - // Get closer to the target if one not peeking. - if (!PeekingOut && target != null) - CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); - - // Retreat if velocity is zero for some reason. - if (NPC.velocity == Vector2.Zero) - { - SnapTimer = 0f; - RetreatingToHidingSpot = true; - NPC.netUpdate = true; - return; - } - - SnapTimer++; - if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) - { - SnapTimer = 0f; - SnapCooldown = 35f; - PeekingOut = false; - RetreatingToHidingSpot = true; - } - - return; - } - - Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); - - // Pick a potential direction to snap out. - // This is important for attacking. - int snapDirectionTries = 0; - float targetSnapAngularThreshold = 0.48f; - while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) - { - snapDirectionTries++; - snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); - - if (snapDirectionTries >= 8) - return; - - // Try again if there's a defined target and it isn't in the line of sight of the current direction. - if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) - continue; - } - - // Snap out if a suitable target gets close. - // Otherwise, sometimes randomly peek out. - bool canSnapAtTarget = - target != null && - snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && - Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); - if (Main.rand.NextBool(30) && !canSnapAtTarget) - PeekingOut = true; - - if (PeekingOut || canSnapAtTarget) - { - if (canSnapAtTarget) - SoundEngine.PlaySound(SoundID.Item96, NPC.Center); - else - SoundEngine.PlaySound(SoundID.Item95, NPC.Center); - - // Add some randomness when peeking. - if (PeekingOut) - snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); - - NPC.velocity = snapDirection * 4f; - InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); - SnapTimer = 1f; - NPC.netUpdate = true; - } - } - - public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) - { - PlayerHurt(); - } - - public void PlayerHurt() - { - NPC.chaseable = true; - } - - public override void FindFrame(int frameHeight) - { - if (NPC.Calamity().newAI[1] == 1) - { - NPC.frameCounter++; - if (NPC.frameCounter > 3) - { - NPC.frameCounter = 0; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) - { - NPC.frame.Y = frameHeight * 5; - } - } - else - { - NPC.frameCounter = 0; - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (InHidingSpot) - return false; - - Texture2D headTexture = ModContent.Request(Texture).Value; - Texture2D body1Texture = SandProwler.BodySprite1.Value; - Texture2D body2Texture = SandProwler.BodySprite2.Value; - Texture2D body3Texture = SandProwler.BodySprite3.Value; - Texture2D body4Texture = SandProwler.BodySprite4.Value; - - Vector2 idealDrawPosition = SpotToHideIn; - Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; - if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) - idealDrawPosition += backOffset; - - List bezierPoints = new List() - { - idealDrawPosition - }; - - // Calculate points to create segments at based on a catmull-rom spine. - float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); - for (int i = 0; i < 20; i++) - { - Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; - Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; - bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); - } - bezierPoints.Add(NPC.Center); - - // And then generalize them with a bezier curve. - BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); - int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); - totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); - - for (int i = 0; i < totalChains - 1; i++) - { - Texture2D textureToUse; - - - if (i % 2 == 0) - { - textureToUse = body3Texture; - } - else - { - textureToUse = body4Texture; - } - - switch (totalChains - i - 1) - { - case 1: - textureToUse = headTexture; - break; - case 2: - textureToUse = body1Texture; - break; - case 3: - textureToUse = body2Texture; - break; - } - - Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); - Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); - float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; - Rectangle frame = textureToUse.Frame(1, 1, 0, 0); - if (textureToUse == headTexture) - { - frame = NPC.frame; - } - Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); - spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); - } - return false; - } - protected override bool NPCSearchFilter(NPC n) - { - return Vector2.DistanceSquared(NPC.Center, n.Center) < 200f * 200f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); - } - - public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - return NPC.life < NPC.lifeMax * 0.99f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); - - 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 && !Main.dedServ) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); - } - 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); - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs new file mode 100644 index 0000000000..4016030b22 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -0,0 +1,319 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SeaSerpent1 : ModNPC + { + public const int maxLength = 9; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + + 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; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 50; //42 + NPC.height = 24; //32 + 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 void AI() + { + 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, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 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 = 0; + if (segment == 0 || segment == 1 || segment == 4 || segment == 5) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 2 || segment == 3 || segment == 6) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 7) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + else if (segment == 8) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), 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; + 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.TargetClosest(false); + 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 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 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.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("SeaSerpentGore1").Type, 1f); + } + } + } + } +} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png new file mode 100644 index 0000000000..0e144e18e2 Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent1.png differ diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs new file mode 100644 index 0000000000..4da1f8d931 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -0,0 +1,147 @@ +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; + } + + 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/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png new file mode 100644 index 0000000000..bdb5c315db Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent2.png differ diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs new file mode 100644 index 0000000000..aac96e6412 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -0,0 +1,145 @@ +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; + } + + 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/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png new file mode 100644 index 0000000000..3ca49fc95e Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent3.png differ diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs new file mode 100644 index 0000000000..5f215471e2 --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -0,0 +1,145 @@ +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; + } + + 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/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png new file mode 100644 index 0000000000..5625d8cf2d Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent4.png differ diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs new file mode 100644 index 0000000000..6549cf604f --- /dev/null +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -0,0 +1,145 @@ +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; + } + + 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/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png new file mode 100644 index 0000000000..2772709ecb Binary files /dev/null and b/NPCs/SunkenSea/SeaSerpent5.png differ diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index 79991669b4..60766f4dec 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.SunkenSea /// /// The NPC to evaluate. /// if the NPC is a valid target; otherwise, . - protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)) && !(n.type == ModContent.NPCType() && n.alpha > 0); + protected virtual bool NPCSearchFilter(NPC n) => NPC.HasSight(n.Center) && Vector2.DistanceSquared(NPC.Center, n.Center) < 72900f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); /// /// Updates the current targets of this creature, including prey, predators, and players, based on detection logic. diff --git a/Projectiles/Enemy/GhostBellShock.cs b/Projectiles/Enemy/GhostBellShock.cs deleted file mode 100644 index 56159811df..0000000000 --- a/Projectiles/Enemy/GhostBellShock.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class GhostBellShock : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Enemy"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - // Max aura size not accounting for babies - public static int MaxDefaultRadius => 160; - - // How much does each baby boost the size of the aura - public static int RadiusBoostPerBaby => 10; - - // Stores the ring points - public List points = []; - - // Stores the bolts which connect from the center to the ring - public List> bolts = []; - - // Stores the bolts which connect to babies - public List> jellyBolts = []; - - // Generic timer - public ref float Timer => ref Projectile.ai[0]; - // The jelly - public ref float Parent => ref Projectile.ai[1]; - // Size of the aura - public ref float CurrentRadius => ref Projectile.ai[2]; - // How many valid babies exist - public ref float CurrentBabies => ref Projectile.localAI[0]; - - public override void SetDefaults() - { - Projectile.width = MaxDefaultRadius * 2; - Projectile.height = MaxDefaultRadius * 2; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.alpha = 255; - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - CurrentBabies = reader.ReadSingle(); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(CurrentBabies); - } - - public override void OnSpawn(IEntitySource source) - { - RecalculateLists(); - } - - public override void AI() - { - bool validOwner = true; - int impactMoment = GhostBell.ElectrifyingPhaseDischarge; - - NPC n = Main.npc[(int)Parent - 1]; - if (n == null || !n.active || n.life < 0) - { - validOwner = false; - } - else - { - Projectile.Center = n.Center; - } - // Recalculate the prims to animate the lightning - if (Projectile.ai[0] % 5 == 0) - { - RecalculateLists(); - } - // Scale the aura size. More babies increases the size of the aura - CurrentRadius = MathHelper.Lerp(0, MaxDefaultRadius + (CurrentBabies * RadiusBoostPerBaby), Utils.GetLerpValue(impactMoment, impactMoment + 10, Timer, true)); - if (Timer == 0 && CurrentBabies > 0) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Pitch = 1f }, Projectile.Center); - } - Timer++; - float pitch = (CurrentBabies > 0 && Timer < impactMoment) ? 1f : 0.4f; - if (Timer % 10 == 0 && (Timer >= impactMoment || CurrentBabies > 0)) - { - SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = pitch }, Projectile.Center); - } - if (Timer == impactMoment) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.Center); - } - if (CurrentBabies > 0 || Timer >= impactMoment) - Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(CurrentRadius, CurrentRadius), DustID.Electric); - // Become opaque - if (Timer < (40 + impactMoment) && validOwner) - { - if (Projectile.alpha > 0) - Projectile.alpha -= 20; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - } - // become transparent and die - else - { - Projectile.alpha += 20; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } - } - } - - public void RecalculateLists() - { - int ringPoints = 60; // How many times can the ring bend - int boltPoints = 12; // How many times can a bolt bend - int minimumBolts = 6; // Minimum number of bolts - int maximumBolts = 12; // Maximum number of bolts - //int minimumSplits = 0; // Minimum number of split bolts - //int maximumSplits = 2; // Maximum number of split bolts - points.Clear(); - bolts.Clear(); - jellyBolts.Clear(); - for (int i = 0; i < ringPoints; i++) - { - // The radius of the aura. Randomized to be electricky - float rad = CurrentRadius + Main.rand.Next(-20, 20); - // Determinte the end point - // This creates a circle with the given radius - Vector2 end = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi + MathHelper.ToRadians(15), (i + 1) / (float)ringPoints)) * rad; - points.Add(Projectile.Center + end); - - // Randomly create more electric bolts that connect from the center to the ring - if (Main.rand.NextBool(ringPoints / Main.rand.Next(minimumBolts, maximumBolts))) - { - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = Projectile.Center + end.RotatedByRandom(MathHelper.PiOver4); - - bolt.Add(start); - for (int j = 0; j < boltPoints; j++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (j + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(10)); - bolt.Add(newPoint); - - // UNUSED code that occasionally gives bolts their own smaller bolts - /*if (Main.rand.NextBool(boltPoints / Main.rand.Next(minimumSplits + 1, maximumSplits + 1)) && j > boltPoints / 2) - { - Main.NewText("Made a bolt"); - List boltSplit = []; - boltSplit.Add(newPoint); - for (int k = 0; k < boltPoints; k++) - { - Vector2 destSplit = Vector2.Lerp(newPoint, Projectile.Center + end.RotatedBy(MathHelper.PiOver4), (k + 1) / (float)boltPoints); - Vector2 difSplit = destSplit - newPoint; - Vector2 newPointSplit = newPoint + difSplit.RotatedByRandom(MathHelper.ToRadians(10)); - boltSplit.Add(newPointSplit); - } - boltSplit.Add(Projectile.Center + end.RotatedBy(MathHelper.PiOver4)); - bolts.Add(boltSplit); - }*/ - } - bolt.Add(boltEnd); - bolts.Add(bolt); - } - - // Re-add the first point so that the trail can form a full circle - if (i == ringPoints - 1) - { - points.Add(points[0]); - } - } - - // Count how many baby jellies exist and tie lightning to them - CurrentBabies = 0; - foreach (NPC n in Main.ActiveNPCs) - { - if (n.type != ModContent.NPCType()) - continue; - if (n.Distance(Projectile.Center) > 400) - continue; - - CurrentBabies++; - - List bolt = []; - Vector2 start = Projectile.Center; - Vector2 boltEnd = n.Center; - - bolt.Add(start); - for (int i = 0; i < boltPoints; i++) - { - Vector2 dest = Vector2.Lerp(start, boltEnd, (i + 1) / (float)boltPoints); - Vector2 dif = dest - start; - Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(4)); - bolt.Add(newPoint); - } - bolt.Add(boltEnd); - jellyBolts.Add(bolt); - } - - Projectile.netUpdate = true; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 60); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.alpha <= 0 && CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius, targetHitbox); - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); - float opacity = 0.6f; - float jellyOpacity = 0.2f; - if (Timer >= GhostBell.ElectrifyingPhaseDischarge) - { - // The aura - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 4, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(points, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - // Bolts inside of the aura - for (int i = 0; i < bolts.Count; i++) - { - List boltPoints = bolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 3, (float completion, Vector2 vertexPos) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - } - // Harmless bolts connecting to babies - for (int i = 0; i < jellyBolts.Count; i++) - { - List boltPoints = jellyBolts[i]; - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 2, (float completion, Vector2 vertexPos) => Color.Cyan * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - PrimitiveRenderer.RenderTrail(boltPoints, new((float completion, Vector2 vertexPos) => 1, (float completion, Vector2 vertexPos) => Color.White * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); - } - Main.spriteBatch.ExitShaderRegion(); - return false; - } - } -} diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a1f1fbd91a..b9b8a2b924 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -1142,13 +1142,6 @@ namespace CalamityMod.Systems #endregion #region Seafood Dinner - r = Recipe.Create(ItemID.SeafoodDinner); - r.AddIngredient(); // Consistency would be 2, but considering you need only 1 for Golden Delight, I'm leaving this at 1 - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.SeafoodDinner); - r.DisableDecraft(); - r = Recipe.Create(ItemID.SeafoodDinner); r.AddIngredient(2); r.AddTile(TileID.CookingPots); @@ -1185,50 +1178,6 @@ namespace CalamityMod.Systems r.DisableDecraft(); #endregion - #region Golden Delight - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - #endregion - r = Recipe.Create(ItemID.BowlofSoup); r.AddIngredient(ItemID.Mushroom); r.AddIngredient(); diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index e9ea19dcf1..d6020c662c 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -391,7 +391,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; /*case 107: npc = NPCType(); - Formerly Giant Clam diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index bc6f2278bd..c53f36c113 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -326,13 +326,17 @@ namespace CalamityMod { ModContent.NPCType(), sulphur }, { ModContent.NPCType(), sulphur }, + { 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(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss },