Files
ForgottenWawiTech/Content/NPCs/OriginalNeptune/Raccoon.cs
T
2025-11-22 14:35:27 +00:00

79 lines
2.8 KiB
C#

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace ForgottenWawiTech.Content.NPCs.OriginalNeptune
{
[AutoloadBossHead]
public class Raccoon : ModNPC
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Raccoon");
Main.npcFrameCount[NPC.type] = 1;
}
public override void SetDefaults()
{
NPC.width = 40;
NPC.height = 40;
NPC.damage = 70;
NPC.defense = 16;
NPC.lifeMax = 18000;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0f;
NPC.boss = true;
NPC.aiStyle = -1; // custom behavior later
NPC.value = Item.buyPrice(0, 1, 75, 0);
}
public override void AI()
{
/*
IDEA:
Mr Raccoon will fight on the ground, throwing himself and projectiles at the player.
He will have a dash attack where he quickly rushes the player, dealing high damage on contact.
He will also have a projectile attack where he throws pieces of trash at the player from a distance.
He is meant to serve as a distraction and secondary threat while Neptune fights from above - meaning to overwhelm the player with multiple threats.
0 - 50% HP: Normal behavior (Phase 1)
50% - 25% HP: Increases dash attack speed and frequency (Phase 2)
25% - 0% HP: Increases all attack speeds and movement speeds (Phase 3)
If Neptune is defeated while Mr Raccoon is still alive, Mr Raccoon will flee the battle (run towards the ocean) - if he is defeated during this state, he will drop a vanity developer set.
*/
Player target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.TargetClosest(false);
target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.velocity.Y -= 0.1f;
}
}
NPC.ai[0]++;
if (NPC.ai[0] < 60)
{
// approach
Vector2 dir = target.Center - NPC.Center;
dir.Normalize();
NPC.velocity = dir * 3f;
}
else if (NPC.ai[0] == 60)
{
// dash
Vector2 dash = target.Center - NPC.Center;
dash.Normalize();
NPC.velocity = dash * 10f;
}
else if (NPC.ai[0] > 120)
{
NPC.ai[0] = 0;
}
NPC.spriteDirection = NPC.direction = (target.Center.X < NPC.Center.X) ? -1 : 1;
}
}
}