Added Festering Remains, no chum yet

This commit is contained in:
GinYuH authored and Cameron Ewell committed 2024-07-30 18:27:16 -04:00
1 parent fe86dc1d82
commit 9719be3e09
10 files changed
+155 -3

No files matched your search

@@ -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
-1
View File
@@ -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;
+101
View File
@@ -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<Particle> bones = new List<Particle>();
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<AlphaSeaMinnowBanner>();
NPC.chaseable = false;
SpawnModBiomes = new int[1] { ModContent.GetInstance<SunkenSeaBiome>().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);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

-2
View File
@@ -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];
+53
View File
@@ -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<Texture2D>(Texture2).Value : ModContent.Request<Texture2D>(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);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B