diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index d21231805d..ad88e78584 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -265,6 +265,7 @@ BabyGhostBell.DisplayName: Baby Ghost Bell BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray +FesteringRemains.DisplayName: Festering Remains GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs index 0ec3ad7c64..66c7fb0b69 100644 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -1,7 +1,6 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Critters; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs new file mode 100644 index 0000000000..d18c85872e --- /dev/null +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -0,0 +1,101 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.DataStructures; +using CalamityMod.Particles; +using System.Collections.Generic; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class FesteringRemains : ModNPC + { + List bones = new List(); + public override void SetDefaults() + { + NPC.width = 52; + NPC.height = 36; + NPC.defense = 0; + NPC.lifeMax = 200; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = 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.HauntedChum") + }); + } + public override void OnSpawn(IEntitySource source) + { + int boneCount = Main.rand.Next(5, 8); + for (int i = 0; i < boneCount; i++) + { + int extraDistX = 120; + int extraDistY = 40; + Vector2 bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + for (int j = 0; j < 50; j++) + { + Tile tilePos = CalamityUtils.ParanoidTileRetrieval((int)bonePos.X / 16, (int)bonePos.Y / 16); + if (tilePos.HasTile) + { + bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + } + } + Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool(), Main.rand.NextBool()); + GeneralParticleHandler.SpawnParticle(bone); + bones.Add(bone); + } + NPC.TargetClosest(); + } + + public override void AI() + { + NPC.damage = 0; + NPC.TargetClosest(); + Player target = Main.player[NPC.target]; + if (target != null && target.active && target.Distance(NPC.Center) < 80) + { + if (NPC.ai[0] == 0) + { + //int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 200, NPCID.HeadacheSkeleton, ai3: NPC.whoAmI); + //NPC.ai[0] = 1; + //NPC.ai[1] = head; + } + } + for (int i = 0; i < bones.Count; i++) + { + bones[i].Time = 2; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/SunkenSea/FesteringRemains.png b/NPCs/SunkenSea/FesteringRemains.png new file mode 100644 index 0000000000..75b78502a4 Binary files /dev/null and b/NPCs/SunkenSea/FesteringRemains.png differ diff --git a/NPCs/SunkenSea/HauntedChum.png b/NPCs/SunkenSea/HauntedChum.png new file mode 100644 index 0000000000..11b9e1f220 Binary files /dev/null and b/NPCs/SunkenSea/HauntedChum.png differ diff --git a/NPCs/SunkenSea/HauntedChumMouth.png b/NPCs/SunkenSea/HauntedChumMouth.png new file mode 100644 index 0000000000..6fa25c049e Binary files /dev/null and b/NPCs/SunkenSea/HauntedChumMouth.png differ diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index 654c80d4c4..0780b479cb 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -382,8 +382,6 @@ namespace CalamityMod.NPCs.SunkenSea public void SegmentAI() { - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; diff --git a/Particles/ChumBone.cs b/Particles/ChumBone.cs new file mode 100644 index 0000000000..b366177b6c --- /dev/null +++ b/Particles/ChumBone.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ChumBone : Particle + { + public override string Texture => "CalamityMod/Particles/ChumBone1"; + + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private bool direction; + private bool variant; + public static string Texture2 => "CalamityMod/Particles/ChumBone2"; + + public ChumBone(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, int lifeTime, bool variant, bool direction) + { + Position = position; + Velocity = velocity; + Scale = scale; + Lifetime = lifeTime; + Rotation = rotation; + Color = color; + } + + public override void Update() + { + // Gravity + Tile below = CalamityUtils.ParanoidTileRetrieval((int)(Position.X / 16), (int)(Position.Y / 16)); + if (!below.HasTile || !below.IsTileSolid() || below.Slope > 0) + { + if (Velocity.Y < 10) + { + Velocity.Y += 1; + } + } + else + { + Velocity.Y = 0; + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = variant ? ModContent.Request(Texture2).Value : ModContent.Request(Texture).Value; + SpriteEffects spriteDir = direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, new Vector2(tex.Width / 2, tex.Height), Scale, spriteDir, 0); + } + } +} diff --git a/Particles/ChumBone1.png b/Particles/ChumBone1.png new file mode 100644 index 0000000000..86bff0e329 Binary files /dev/null and b/Particles/ChumBone1.png differ diff --git a/Particles/ChumBone2.png b/Particles/ChumBone2.png new file mode 100644 index 0000000000..58961d2094 Binary files /dev/null and b/Particles/ChumBone2.png differ