diff --git a/BiomeManagers/ClamDen.cs b/BiomeManagers/ClamDen.cs new file mode 100644 index 0000000000..f4d06835a9 --- /dev/null +++ b/BiomeManagers/ClamDen.cs @@ -0,0 +1,31 @@ +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class ClamDenBiome : ModBiome + { + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Sunken Sea background + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; + + // todo make this condition different than the normal burrows + public override bool IsBiomeActive(Player player) + { + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 && MoreThanReefs && MoreThanPolyp; + } + } +} diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a634f65b31..67817147c9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1525,11 +1525,12 @@ namespace CalamityMod.CalPlayer #endregion #region Biome - public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneBasaltGully; + public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneClamDen || ZoneBasaltGully; public bool ZoneTimelessShores => Player.InModBiome(); public bool ZonePolypForest => Player.InModBiome(); public bool ZoneRadiantReefs => Player.InModBiome(); public bool ZoneGleamingBurrows => Player.InModBiome(); + public bool ZoneClamDen => Player.InModBiome(); public bool ZoneBasaltGully => Player.InModBiome(); public bool ZoneSulphur => Player.InModBiome(); diff --git a/Enums/SunkenSeaBiomeFlags.cs b/Enums/SunkenSeaBiomeFlags.cs index 60de02c354..061c88f079 100644 --- a/Enums/SunkenSeaBiomeFlags.cs +++ b/Enums/SunkenSeaBiomeFlags.cs @@ -15,5 +15,6 @@ namespace CalamityMod.Enums PolypForest = 8, GleamingBurrows = 16, BasaltGully = 32, + ClamDen = 64 } } diff --git a/Localization/en-US/Mods.CalamityMod.Biomes.hjson b/Localization/en-US/Mods.CalamityMod.Biomes.hjson index b3057f8810..358dcf4571 100644 --- a/Localization/en-US/Mods.CalamityMod.Biomes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Biomes.hjson @@ -110,3 +110,8 @@ TimelessShoresBiome: { DisplayName: Timeless Shores Biome TownNPCDialogueName: the Timeless Shores Biome } + +ClamDenBiome: { + DisplayName: Clam Den Biome + TownNPCDialogueName: the Clam Den Biome +} diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index de57dfa6b1..57b14a0f8d 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -3,7 +3,15 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -12,9 +20,54 @@ namespace CalamityMod.NPCs.SunkenSea { public class Clam : ModNPC { - private int hitAmount = 0; - private bool hasBeenHit = false; - private bool statChange = false; + public enum PersonalityTypes + { + Reefs = 0, + Burrows = 1, + Den = 2 + } + + public enum PhaseType + { + Idle = 0, + Attacking = 1, + Squirt = 2 + } + + public Player Target => Main.player[NPC.target]; + + public ref float CurrentPhase => ref NPC.ai[0]; + + public ref float Timer => ref NPC.ai[1]; + + public ref float Personality => ref NPC.ai[3]; + + public ref float ShellRotation => ref NPC.localAI[0]; + + #region Textures + + public static Asset bottomJawTex; + + public static Asset bottomJawTexAlgae; + + public static Asset bottomJawTexCoral; + + public static Asset algaeTex; + + public static Asset coralTex; + + public static Asset backTex; + #endregion + + public override void Load() + { + backTex = ModContent.Request(Texture + "Back"); + bottomJawTex = ModContent.Request(Texture + "Bottom"); + bottomJawTexAlgae = ModContent.Request(Texture + "BottomAlgae"); + bottomJawTexCoral = ModContent.Request(Texture + "BottomCoral"); + algaeTex = ModContent.Request(Texture + "Algae"); + coralTex = ModContent.Request(Texture + "Coral"); + } public override void SetStaticDefaults() { @@ -29,8 +82,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { NPC.damage = Main.hardMode ? 60 : 30; - NPC.width = 56; - NPC.height = 38; + NPC.width = 50; + NPC.height = 30; NPC.defense = 9999; NPC.DR_NERD(0.25f); NPC.lifeMax = Main.hardMode ? 300 : 150; @@ -42,9 +95,10 @@ namespace CalamityMod.NPCs.SunkenSea AIType = -1; NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit4; - NPC.knockBackResist = 0.05f; + NPC.knockBackResist = 0; Banner = NPC.type; BannerItem = ModContent.ItemType(); + NPC.GravityIgnoresLiquid = true; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; @@ -66,122 +120,260 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { - writer.Write(hitAmount); - writer.Write(NPC.chaseable); - writer.Write(hasBeenHit); - writer.Write(statChange); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { - hitAmount = reader.ReadInt32(); - NPC.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); - statChange = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + } + + public override void OnSpawn(IEntitySource source) + { + NPC.TargetClosest(); + + if (Target.Calamity().ZoneClamDen) + Personality = (int)PersonalityTypes.Den; + else if (Target.Calamity().ZoneGleamingBurrows) + Personality = (int)PersonalityTypes.Burrows; + else + Personality = (int)PersonalityTypes.Reefs; } public override void AI() { - NPC.TargetClosest(true); + NPC.TargetClosest(false); + // Always be mad during Clamity if (Main.player[NPC.target].Calamity().clamity) { - hitAmount = 3; - hasBeenHit = true; + Personality = (int)PersonalityTypes.Burrows; } - if (NPC.justHit && hitAmount < 3) + switch (CurrentPhase) { - ++hitAmount; - hasBeenHit = true; - } - NPC.chaseable = hasBeenHit; - if (hitAmount == 3) - { - if (!statChange) - { - NPC.defense = Main.hardMode ? 15 : 6; - NPC.damage = NPC.defDamage; - statChange = true; - } - if (NPC.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) + case (int)PhaseType.Idle: { - if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9) + NPC.velocity.X *= 0.9f; + switch (Personality) { - NPC.ai[0] = 1f; - NPC.netUpdate = true; - return; + // Aggro immediately + case (int)PersonalityTypes.Den: + { + ChangePhase((int)PhaseType.Attacking); + } + break; + // Aggro if the player is near + case (int)PersonalityTypes.Burrows: + { + if (Target.Distance(NPC.Center) < 600 && NPC.HasSight(Target.Center)) + { + ChangePhase((int)PhaseType.Attacking); + } + } + break; + // Aggro if hurt + default: + { + if (NPC.life < (NPC.lifeMax - 2)) + { + ChangePhase((int)PhaseType.Attacking); + } + } + break; } + // If it aggro'd, decrease kb resist and defense since it's no longer stuck in the ground + if (CurrentPhase == (int)PhaseType.Attacking) + { + NPC.knockBackResist = 0.05f; + NPC.defense = Main.hardMode ? 15 : 6; + } + } + break; + case (int)PhaseType.Attacking: + { + Timer++; + // Squirt + if (Timer > 0) + { + ChangePhase((int)PhaseType.Squirt); + NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); + } + } + break; + case (int)PhaseType.Squirt: + { + // Slow down. Once the clam is rested, start incrementing Timer + if (NPC.velocity.Y == 0) + { + NPC.velocity.X *= 0.8f; + // Set ai[2] to 1 + NPC.ai[2] = 1; + } + + // Increment Timer is ai[2] is 1 + if (NPC.ai[2] == 1) + { + Timer++; + } + + // When to start opening + float startOpen = 30; + // When to end opening + float endOpen = startOpen + 30; + // When to start closing + float startClose = endOpen + 20; + // When to stop closing + float endClose = startClose + 5; + // When to go to the next attack + float reset = endClose + 60; + // Rotation at its peak + float maxRotation = MathHelper.ToRadians(80); + + // Direction the player is relative to the clam + int playerPosition = NPC.DirectionTo(Target.Center).X.DirectionalSign(); + + // Shell animation + if (Timer >= startOpen && Timer <= endOpen) + { + ShellRotation = (float)Utils.AngleLerp(0, maxRotation * -NPC.spriteDirection, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startOpen, endOpen, Timer, true), 0)); + } + else if (Timer >= startClose && Timer <= endClose) + { + ShellRotation = (float)Utils.AngleLerp(maxRotation * -NPC.spriteDirection, 0, CalamityUtils.SineOutEasing(Utils.GetLerpValue(startClose, endClose, Timer, true), 0)); + } + + // Fire the projectile + if (Timer == (endClose - 5)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * 5; + + // If the player is on the other side of the clam, flip the jet so that it doesn't fire backwards + if (playerPosition != NPC.direction) + velocity.X *= -1; + + int p = Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), NPC.damage, 1); + Main.projectile[p].friendly = false; + Main.projectile[p].hostile = true; + Main.projectile[p].DamageType = DamageClass.Default; + } + for (int i = 0; i < 9; i++) + { + GenericBubbleParticle waterFlavored = new GenericBubbleParticle(NPC.Center, Main.rand.NextFloat(16, 22) * NPC.DirectionTo(Target.Center).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(-4, 4), 5); + waterFlavored.AffectedByLight = true; + GeneralParticleHandler.SpawnParticle(waterFlavored); + } + + SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), NPC.Center); + SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), NPC.Center); + } + + // Go back to melee + if (Timer >= reset) + { + ChangePhase((int)PhaseType.Attacking); + } + } + break; + } + NPC.spriteDirection = NPC.direction; + /*if (!statChange) + { + NPC.defense = Main.hardMode ? 15 : 6; + NPC.damage = NPC.defDamage; + statChange = true; + } + if (NPC.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.velocity.X != 0f || NPC.velocity.Y < 0f || (double)NPC.velocity.Y > 0.9) + { NPC.ai[0] = 1f; NPC.netUpdate = true; return; } - } - else if (NPC.velocity.Y == 0f) - { - NPC.ai[2] += 1f; - int decelerationTimer = 20; - if (NPC.ai[1] == 0f) - { - decelerationTimer = 12; - } - if (NPC.ai[2] < (float)decelerationTimer) - { - NPC.velocity.X *= 0.9f; - return; - } - NPC.ai[2] = 0f; - NPC.TargetClosest(true); - if (NPC.direction == 0) - { - NPC.direction = -1; - } - NPC.spriteDirection = -NPC.direction; - NPC.ai[1] += 1f; - NPC.ai[3] += 1f; - if (NPC.ai[3] >= 4f) - { - NPC.ai[3] = 0f; - if (NPC.ai[1] == 2f) - { - float multiplierX = (float)Main.rand.Next(3, 7); - NPC.velocity.X = (float)NPC.direction * multiplierX; - NPC.velocity.Y = -8f; - NPC.ai[1] = 0f; - } - else - { - float multiplierX = (float)Main.rand.Next(5, 9); - NPC.velocity.X = (float)NPC.direction * multiplierX; - NPC.velocity.Y = -4f; - } - } + NPC.ai[0] = 1f; NPC.netUpdate = true; return; } - else + } + else if (NPC.velocity.Y == 0f) + { + NPC.ai[2] += 1f; + int decelerationTimer = 20; + if (NPC.ai[1] == 0f) { - if (NPC.direction == 1 && NPC.velocity.X < 1f) + decelerationTimer = 12; + } + if (NPC.ai[2] < (float)decelerationTimer) + { + NPC.velocity.X *= 0.9f; + return; + } + NPC.ai[2] = 0f; + NPC.TargetClosest(true); + if (NPC.direction == 0) + { + NPC.direction = -1; + } + NPC.spriteDirection = -NPC.direction; + NPC.ai[1] += 1f; + NPC.ai[3] += 1f; + if (NPC.ai[3] >= 4f) + { + NPC.ai[3] = 0f; + if (NPC.ai[1] == 2f) { - NPC.velocity.X = NPC.velocity.X + 0.1f; - return; + float multiplierX = (float)Main.rand.Next(3, 7); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -8f; + NPC.ai[1] = 0f; } - if (NPC.direction == -1 && NPC.velocity.X > -1f) + else { - NPC.velocity.X = NPC.velocity.X - 0.1f; - return; + float multiplierX = (float)Main.rand.Next(5, 9); + NPC.velocity.X = (float)NPC.direction * multiplierX; + NPC.velocity.Y = -4f; } } + NPC.netUpdate = true; + return; } else - NPC.damage = 0; + { + if (NPC.direction == 1 && NPC.velocity.X < 1f) + { + NPC.velocity.X = NPC.velocity.X + 0.1f; + return; + } + if (NPC.direction == -1 && NPC.velocity.X > -1f) + { + NPC.velocity.X = NPC.velocity.X - 0.1f; + return; + } + }*/ + } + + public void ChangePhase(int phaseNum, bool resetai2 = true) + { + CurrentPhase = phaseNum; + Timer = 0; + if (resetai2) + NPC.ai[2] = 0; + NPC.netUpdate = true; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return CurrentPhase > 0; } public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return hasBeenHit; + return CurrentPhase > 0; } return null; } @@ -194,7 +386,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (hitAmount < 3) + if (CurrentPhase == 0) { NPC.frame.Y = frameHeight * 4; } @@ -245,5 +437,23 @@ namespace CalamityMod.NPCs.SunkenSea npcLoot.Add(ItemID.PinkPearl, 40); npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D tex = TextureAssets.Npc[NPC.type].Value; + Vector2 drawOffset = Vector2.UnitY * 8; + Vector2 topDrawOffset = drawOffset + new Vector2(NPC.spriteDirection * -22, -3); + bool facingRight = NPC.spriteDirection == 1; + if (facingRight) + { + topDrawOffset.X += 6; + } + Vector2 backOffset = topDrawOffset; + if (ShellRotation == 0) + spriteBatch.Draw(backTex.Value, NPC.Center - screenPos + backOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(tex, NPC.Center - screenPos + topDrawOffset, null, NPC.GetAlpha(drawColor), ShellRotation, new Vector2(facingRight ? 0 : tex.Width, tex.Height), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + spriteBatch.Draw(bottomJawTex.Value, NPC.Center - screenPos + drawOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + return false; + } } } diff --git a/NPCs/SunkenSea/Clam.png b/NPCs/SunkenSea/Clam.png index f7eb5f074a..acb6f0dd51 100644 Binary files a/NPCs/SunkenSea/Clam.png and b/NPCs/SunkenSea/Clam.png differ diff --git a/NPCs/SunkenSea/ClamAlgae.png b/NPCs/SunkenSea/ClamAlgae.png new file mode 100644 index 0000000000..e695d282f8 Binary files /dev/null and b/NPCs/SunkenSea/ClamAlgae.png differ diff --git a/NPCs/SunkenSea/ClamBack.png b/NPCs/SunkenSea/ClamBack.png new file mode 100644 index 0000000000..7eec13a3b9 Binary files /dev/null and b/NPCs/SunkenSea/ClamBack.png differ diff --git a/NPCs/SunkenSea/ClamBottom.png b/NPCs/SunkenSea/ClamBottom.png new file mode 100644 index 0000000000..3d9a5ddeeb Binary files /dev/null and b/NPCs/SunkenSea/ClamBottom.png differ diff --git a/NPCs/SunkenSea/ClamBottomAlgae.png b/NPCs/SunkenSea/ClamBottomAlgae.png new file mode 100644 index 0000000000..c3f133e6c0 Binary files /dev/null and b/NPCs/SunkenSea/ClamBottomAlgae.png differ diff --git a/NPCs/SunkenSea/ClamBottomCoral.png b/NPCs/SunkenSea/ClamBottomCoral.png new file mode 100644 index 0000000000..103aaa2e63 Binary files /dev/null and b/NPCs/SunkenSea/ClamBottomCoral.png differ diff --git a/NPCs/SunkenSea/ClamCoral.png b/NPCs/SunkenSea/ClamCoral.png new file mode 100644 index 0000000000..aad2819891 Binary files /dev/null and b/NPCs/SunkenSea/ClamCoral.png differ diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs index 59ef4255be..4bf8a36598 100644 --- a/NPCs/SunkenSea/HauntedChum.cs +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -42,6 +42,9 @@ namespace CalamityMod.NPCs.SunkenSea NPC.noGravity = true; NPC.noTileCollide = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs index d2dd52a8b2..d86b9f83e4 100644 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -57,6 +57,10 @@ namespace CalamityMod.NPCs.SunkenSea // Banner = NPC.type; //BannerItem = ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs index a4b3b0d7cf..ad507b3920 100644 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -80,6 +80,9 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/Leerslug.cs b/NPCs/SunkenSea/Leerslug.cs index 6dd92d64a4..780fa0bf0a 100644 --- a/NPCs/SunkenSea/Leerslug.cs +++ b/NPCs/SunkenSea/Leerslug.cs @@ -35,6 +35,9 @@ namespace CalamityMod.NPCs.SunkenSea public ref float Timer => ref NPC.ai[1]; + /// + /// Handles the visual scale for the slug + /// public Vector2 squish = new Vector2(); public Player Target => Main.player[NPC.target]; @@ -64,6 +67,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void ReceiveExtraAI(BinaryReader reader) @@ -98,31 +105,38 @@ namespace CalamityMod.NPCs.SunkenSea { case (int)PhaseType.Idle: { + // Flip direction and slow down if it's still moving from a previous cycle if (Timer == 0 && Main.rand.NextBool()) { NPC.direction *= -1; NPC.velocity.X *= 0.9f; } + // Move horizontally in short bursts else if (Timer >= Main.rand.Next(30, 90) && NPC.velocity.Y == 0 && Math.Abs(NPC.velocity.X) < 1 && NPC.ai[2] == 0) { NPC.ai[2] = 1; NPC.velocity.X = Main.rand.NextFloat(2, 4) * Main.rand.NextBool().ToDirectionInt(); } + // Increment the timer before the burst ends if (NPC.ai[2] == 1) { NPC.ai[3]++; } + // Slowdown after a burst else if (NPC.ai[2] == 2 && NPC.velocity.Y == 0) { NPC.velocity.X *= 0.9f; NPC.ai[3]++; } + // Handle movement states if (NPC.ai[3] > Main.rand.Next(20, 40)) { + // If the slug is moving, enter slowdown if (NPC.ai[2] == 1) NPC.ai[2] = 2; + // If the slug is in slowdown, reset else if (NPC.ai[2] == 2) ChangePhase((int)PhaseType.Idle); NPC.ai[3] = 0; @@ -130,6 +144,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.direction = NPC.velocity.X.DirectionalSign(); + // Aggro if (Target.active && Target.Distance(NPC.Center) < 400 && NPC.HasSight(Target.Center)) { ChangePhase((int)PhaseType.Rawr); @@ -141,6 +156,7 @@ namespace CalamityMod.NPCs.SunkenSea int roar = 40; int startAI = 70; NPC.velocity.X *= 0.9f; + // Roar in place with a lil jump if (Timer == roar) { SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); @@ -156,11 +172,13 @@ namespace CalamityMod.NPCs.SunkenSea break; case (int)PhaseType.Jumps: { + // Do a few hops towards the player int maxJumps = 3; if (NPC.ai[2] >= maxJumps - 1 && NPC.velocity.Y == 0) { ChangePhase((int)PhaseType.Dash); } + // Jump if (NPC.velocity.Y == 0) { NPC.velocity.Y = -5; @@ -172,20 +190,24 @@ namespace CalamityMod.NPCs.SunkenSea break; case (int)PhaseType.Dash: { + // Squash and stretch to telegraph the dash int squash = 30; int stretch = 10; Vector2 squashAmt = new Vector2(0.6f, 1.5f); RawrAnimation(squash, stretch, squashAmt); + // Slow down before dashing if (Timer < squash + 10) { NPC.velocity.X *= 0.95f; NPC.direction = NPC.DirectionTo(Target.Center).X.DirectionalSign(); } + // Dash else if (Timer == squash + 10) { NPC.velocity.X = NPC.DirectionTo(Target.Center).X.DirectionalSign() * 6; SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot, NPC.Center); } + // Leave behind some hot mist particles else { if (Timer % 2 == 0) @@ -209,15 +231,18 @@ namespace CalamityMod.NPCs.SunkenSea { int squash = squashDuration; int stretch = squash + stretchDuration; + // rawrxd if (Timer == squash) { SoundEngine.PlaySound(SoundID.Zombie7 with { Pitch = 0.7f }, NPC.Center); } + // Squash if (Timer < squash) { squish.X = MathHelper.Lerp(1, squashAmt.X, Utils.GetLerpValue(0, squash, Timer, true)); squish.Y = MathHelper.Lerp(1, squashAmt.Y, Utils.GetLerpValue(0, squash, Timer, true)); } + // Stretch else if (Timer >= squash && Timer < stretch) { squish.X = MathHelper.Lerp(squashAmt.X, 1, Utils.GetLerpValue(squash, stretch, Timer, true)); @@ -233,6 +258,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.ai[2] = 0; if (resetai3) NPC.ai[3] = 0; + NPC.netUpdate = true; } public override void FindFrame(int frameHeight) diff --git a/NPCs/SunkenSea/Polyperil.cs b/NPCs/SunkenSea/Polyperil.cs index eaee0e59b8..9a166a1317 100644 --- a/NPCs/SunkenSea/Polyperil.cs +++ b/NPCs/SunkenSea/Polyperil.cs @@ -74,6 +74,9 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void OnSpawn(IEntitySource source) diff --git a/NPCs/SunkenSea/PolyperilTentacle.cs b/NPCs/SunkenSea/PolyperilTentacle.cs index b08fdc3677..ad7b1e57a6 100644 --- a/NPCs/SunkenSea/PolyperilTentacle.cs +++ b/NPCs/SunkenSea/PolyperilTentacle.cs @@ -71,6 +71,9 @@ namespace CalamityMod.NPCs.SunkenSea NPC.value = 0; // Banner = NPC.type; // BannerItem = ModContent.ItemType(); + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs index 6c6b4b3f7f..2645577fd6 100644 --- a/NPCs/SunkenSea/Sharkoon.cs +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -199,6 +199,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } #endregion diff --git a/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs index 5fb07cab3d..0b6319d9b2 100644 --- a/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs +++ b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Systems.Collections { SunkenSeaBiomeFlags.PolypForest, (spawnInfo => spawnInfo.Player.Calamity().ZonePolypForest, GetInstance().Type) }, { SunkenSeaBiomeFlags.GleamingBurrows, (spawnInfo => spawnInfo.Player.Calamity().ZoneGleamingBurrows, GetInstance().Type) }, { SunkenSeaBiomeFlags.BasaltGully, (spawnInfo => spawnInfo.Player.Calamity().ZoneBasaltGully, GetInstance().Type) }, + { SunkenSeaBiomeFlags.ClamDen, (spawnInfo => spawnInfo.Player.Calamity().ZoneClamDen, GetInstance().Type) }, }; }