54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace ForgottenWawiTech.Content.NPCs.OriginalLyyka
|
|
{
|
|
[AutoloadBossHead]
|
|
public class Clara : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
// DisplayName.SetDefault("Clara");
|
|
Main.npcFrameCount[NPC.type] = 1;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
NPC.width = 44;
|
|
NPC.height = 44;
|
|
NPC.damage = 65;
|
|
NPC.defense = 18;
|
|
NPC.lifeMax = 15000;
|
|
NPC.HitSound = SoundID.NPCHit1;
|
|
NPC.DeathSound = SoundID.NPCDeath1;
|
|
NPC.knockBackResist = 0f;
|
|
NPC.boss = true;
|
|
NPC.aiStyle = -1; // placeholder
|
|
NPC.value = Item.buyPrice(0, 1, 50, 0);
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
// Placeholder AI: simple orbiting motion around spawn point
|
|
Vector2 center = NPC.ai[0] != 0 ? new Vector2(NPC.ai[1], NPC.ai[2]) : NPC.Center;
|
|
if (NPC.ai[0] == 0)
|
|
{
|
|
NPC.ai[0] = 1;
|
|
NPC.ai[1] = NPC.Center.X;
|
|
NPC.ai[2] = NPC.Center.Y;
|
|
}
|
|
|
|
float orbitRadius = 120f;
|
|
NPC.ai[3] += 0.02f;
|
|
float angle = NPC.ai[3];
|
|
Vector2 targetPos = new Vector2(NPC.ai[1], NPC.ai[2]) + orbitRadius * new Vector2((float)System.Math.Cos(angle), (float)System.Math.Sin(angle));
|
|
Vector2 move = targetPos - NPC.Center;
|
|
float speed = 6f;
|
|
if (move.Length() > speed)
|
|
move = Vector2.Normalize(move) * speed;
|
|
NPC.velocity = (NPC.velocity * 20f + move) / 21f;
|
|
}
|
|
}
|
|
} |