Files
ForgottenWawiTech/Content/NPCs/OriginalNeptune/Neptune.cs
T
2025-12-21 21:58:38 +00:00

168 lines
7.5 KiB
C#

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Terraria.Chat;
using Terraria.Localization;
using Terraria.GameContent.ItemDropRules;
using ForgottenWawiTech.Content.Items.TreasureBags;
namespace ForgottenWawiTech.Content.NPCs.OriginalNeptune
{
[AutoloadBossHead]
public class Neptune : ModNPC
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Original Neptune");
Main.npcFrameCount[NPC.type] = 1;
}
public override void SetDefaults()
{
NPC.width = 40;
NPC.height = 40;
NPC.damage = 1786;
NPC.defense = 290;
NPC.lifeMax = 1000000;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0f;
NPC.boss = true;
NPC.aiStyle = -1;
NPC.value = Item.buyPrice(0, 1, 0, 0);
}
public override void AI()
{
// Spawn condition: Only allows spawning if in the Ocean biome.
/*
IDEA:
Neptune will mostly hover and fly around at high speeds on a ship similiar to the Respawn Ship from SOT.
He will fire projectiles at high speeds which cause high AOE damage and inflict strong crushing debuffs.
All players will receive a debuff (Content.Buffs.Debuffs.Waved) that nullifies wing time while fighting him.
At 50% health, he will "throw" Mr Raccoon off the ship to fight on the ground with the player. His AI will be listed in his file.
During this time, Neptune will become mildly less aggressive, however still dangerous and on the offensive.
At 25% health, he will double his attack speed and movement speed, becoming a frantic danger to players.
100 - 50% HP will be Phase 1
50% - 25% HP will be Phase 2 (Raccoon fight)
25% - 0% HP will be Phase 3
If Neptune is hit with 2/3/4 (Normal/Expert/Master) cannon balls while above 95% HP, he will throw Raccoon overboard and swap AI (only if this happens in Phase 1):
- Neptune will become enraged, tripling attack speed, movement speed, damage, projectile speed, attack range, and reducing all cooldowns by 75%.
- He will also become invulnerable, only taking damage over time until being defeated after ~10 minutes.
- In the last 30 seconds of this state, he will enter a "final stand" mode where he salutes and fires a massive barrage of projectiles rapidly, before ramming
the ship into the floor, causing a humongous explosion (no tile damage) that will insta kill players in range (~70 tiles).
- After being defeated in this state, he will drop an item that functions as infinite wood biome-respected alongside a developer vanity set.
*/
/*
IDEA: Attack ideas from Neptune
- Neptune will occasionally will try and snipe the player(s) with a high damage, high speed trident using predictive aiming. Damage will be 100 - 150 with full armor penetration (ignores defense).
- If the player gets in front of the ship, the ship throws fire at the player, dealing 300 damage and inflicting On Fire! or Brimstone Flames for 10 seconds.
- The ship will drop explosive barrels that act like mines - when the player gets close they explode for high damage.
- During Phase 2, Neptune will throw 6-8 hunting spears overboard straight down, each equally distant from each other, and if the player is hit, it deals 300 damage (full armor pen) and inflicts a custom debuff "Pierced" that reduces healing received by 50% for 10 seconds. Will move slowly.
*/
NPC.TargetClosest(false);
Player target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.timeLeft = 300;
return;
}
int phase = (int)NPC.ai[0]; // 0 = phase 1 (initial), 1 = waiting for raccoon, 2 = phase 2
int flags = (int)NPC.ai[1]; // bitflags: bit0 = raccoon spawned
// Phase 0: before Raccoon summoned
if (phase == 0)
{
// If at or below 50% life and raccoon hasn't been spawned, spawn it and enter waiting state
if (NPC.life <= NPC.lifeMax / 2 && (flags & 1) == 0)
{
flags |= 1;
NPC.ai[1] = flags;
// Make Neptune invulnerable and enter waiting phase
NPC.dontTakeDamage = true;
NPC.ai[0] = 1;
NPC.netUpdate = true;
string announce = "A mischievous raccoon scurries into the battlefield!";
}
// Simple approach movement when not waiting
if (NPC.ai[0] == 0)
{
Vector2 dir = (target.Center - NPC.Center);
if (dir.Length() > 8f)
{
dir.Normalize();
NPC.velocity = Vector2.Lerp(NPC.velocity, dir * 3f, 0.02f);
}
}
}
// Phase 1: waiting for Raccoon to be defeated
else if (phase == 1)
{
bool raccoonAlive = false;
int raccoonType = ModContent.NPCType<Raccoon>();
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC check = Main.npc[i];
if (check.active && check.type == raccoonType)
{
raccoonAlive = true;
break;
}
}
// Stay invulnerable and idle until raccoon is gone
if (!raccoonAlive)
{
NPC.dontTakeDamage = false;
NPC.ai[0] = 2; // enter Phase 2
NPC.netUpdate = true;
}
else
{
// idle drift while waiting
NPC.velocity *= 0.98f;
}
}
// Phase 2+: normal behaviour (placeholder movement)
else
{
Vector2 dir = (target.Center - NPC.Center);
if (dir.Length() > 8f)
{
dir.Normalize();
NPC.velocity = Vector2.Lerp(NPC.velocity, dir * 4f, 0.02f);
}
NPC.spriteDirection = NPC.direction = (target.Center.X < NPC.Center.X) ? -1 : 1;
}
}
public override void OnKill()
{
/* // Spawn NeptuneNPC when killed
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<NeptuneNPC>());
}
else
{
NetMessage.SendData(MessageID.SpawnNPC, number: ModContent.NPCType<NeptuneNPC>(), number2: NPC.whoAmI);
} */
// Set a world flag or similar to indicate Neptune has been defeated
WorldDefeatedBosses.Neptune = true;
// Immediate sync of world flags
WorldDefeatedBosses.Sync(ModContent.GetInstance<ForgottenWawiTech>());
}
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType<NeptuneBossBag>()));
}
}
}