146 lines
4.2 KiB
C#
146 lines
4.2 KiB
C#
using System.IO;
|
|
using Decimation.Lib.NPCs;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace Decimation.Content.NPCs.DuneWyrm.AncientTombCrawler
|
|
{
|
|
|
|
public class AncientTombCrawlerFriendlyHead : AncientTombCrawlerFriendly
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
npc.damage = 50;
|
|
npc.defense = 5;
|
|
npc.width = 38;
|
|
npc.height = 38;
|
|
npc.value = Item.buyPrice(gold: 3);
|
|
npc.npcSlots = 1f;
|
|
npc.aiStyle = -1;
|
|
npc.dontTakeDamage = true;
|
|
}
|
|
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
head = true;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
|
|
{
|
|
Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerHead", spriteBatch, drawColor);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public class AncientTombCrawlerFriendlyBody : AncientTombCrawlerFriendly
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
npc.width = 24;
|
|
npc.height = 24;
|
|
npc.damage = 35;
|
|
npc.defense = 2;
|
|
npc.lifeMax = 1;
|
|
npc.dontCountMe = true;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
|
|
{
|
|
Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerBody", spriteBatch, drawColor);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public class AncientTombCrawlerFriendlyTail : AncientTombCrawlerFriendly
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
npc.width = 20;
|
|
npc.height = 20;
|
|
npc.damage = 35;
|
|
npc.defense = 2;
|
|
npc.lifeMax = 1;
|
|
npc.dontCountMe = true;
|
|
}
|
|
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
tail = true;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
|
|
{
|
|
Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerTail", spriteBatch, drawColor);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public abstract class AncientTombCrawlerFriendly : Worm
|
|
{
|
|
protected const float BaseSpeed = 10f;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Ancient Tomb Crawler");
|
|
}
|
|
|
|
public override void Init()
|
|
{
|
|
minLength = 8;
|
|
maxLength = 8;
|
|
tailType = ModContent.NPCType<AncientTombCrawlerTail>();
|
|
bodyType = ModContent.NPCType<AncientTombCrawlerBody>();
|
|
headType = ModContent.NPCType<AncientTombCrawlerHead>();
|
|
speed = BaseSpeed;
|
|
turnSpeed = 0.045f;
|
|
npc.scale = 1.5f;
|
|
npc.lavaImmune = true;
|
|
npc.noGravity = true;
|
|
npc.noTileCollide = true;
|
|
npc.behindTiles = true;
|
|
npc.knockBackResist = 0f;
|
|
npc.netAlways = true;
|
|
npc.DeathSound = SoundID.NPCDeath18;
|
|
npc.HitSound = SoundID.NPCHit1;
|
|
undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake");
|
|
}
|
|
|
|
protected override void SendSoundPacket()
|
|
{
|
|
// GetPacket(AncientTombCrawlerMessageType.UndergroundSound).Send();
|
|
}
|
|
|
|
private ModPacket GetPacket(AncientTombCrawlerMessageType type)
|
|
{
|
|
ModPacket packet = mod.GetPacket();
|
|
// packet.Write((byte) DecimationModMessageType.AncientTombCrawler);
|
|
// packet.Write(npc.whoAmI);
|
|
// packet.Write((byte) type);
|
|
return packet;
|
|
}
|
|
|
|
public void HandlePacket(BinaryReader reader)
|
|
{
|
|
// AncientTombCrawlerMessageType type = (AncientTombCrawlerMessageType) reader.ReadByte();
|
|
// switch (type)
|
|
// {
|
|
// case AncientTombCrawlerMessageType.UndergroundSound:
|
|
// Main.PlaySound(undergroundSound, npc.Center);
|
|
// break;
|
|
// }
|
|
}
|
|
|
|
public override bool ShouldRun()
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
} |