50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace ForgottenWawiTech.Content.NPCs.OriginalLyyka
|
|
{
|
|
[AutoloadBossHead]
|
|
public class Terra : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
// DisplayName.SetDefault("Terra");
|
|
Main.npcFrameCount[NPC.type] = 1;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.width = 48;
|
|
NPC.height = 48;
|
|
NPC.damage = 80;
|
|
NPC.defense = 20;
|
|
NPC.lifeMax = 20000;
|
|
NPC.HitSound = SoundID.NPCHit1;
|
|
NPC.DeathSound = SoundID.NPCDeath1;
|
|
NPC.knockBackResist = 0f;
|
|
NPC.boss = true;
|
|
NPC.aiStyle = -1; // custom AI will be added later
|
|
NPC.value = Item.buyPrice(0, 2, 0, 0);
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
// Placeholder AI: hover in place and face the player
|
|
Player target = Main.player[NPC.target];
|
|
if (!target.active || target.dead)
|
|
{
|
|
NPC.TargetClosest(false);
|
|
target = Main.player[NPC.target];
|
|
|
|
}
|
|
|
|
Vector2 direction = target.Center - NPC.Center;
|
|
direction.Normalize();
|
|
float speed = 2.5f;
|
|
NPC.velocity = (NPC.velocity * 30f + direction * speed) / 31f;
|
|
NPC.spriteDirection = NPC.direction = (direction.X < 0f) ? -1 : 1;
|
|
}
|
|
}
|
|
} |